I suspect you want something like:
public static Matcher<SomeObject> createPredicate(final List<String> ids) {
return new Predicate<SomeObject>() {
public boolean apply(SomeObject specialObj) {
return ids.contains(specialObj.getTypeId());
}
};
}
You've got to make it a method rather than just a field, as otherwise you've got nowhere to pass the list. The parameter has to be final so that you can use it within the anonymous inner class.