I'm trying to create a finder which takes several predicates and reduces them:
public static <T extends BusinessInterface> Collection<T> findOr(
Context pContext, Class<T> pClass, Predicate<? super T>... pPredicates) {
Predicate<? super T> lReducedPredicate =
Arrays.asList(pPredicates).stream().reduce(Predicate::or).orElse(r -> false);
return find(pContext, pClass, lReducedPredicate);
}
Unfortunately I get following compiler error:
Predicate lReducedPredicate = Arrays.asList(pPredicates).stream().reduce(Predicate::or).orElse(r -> false); incompatible types: Predicate cannot be converted to Predicate where T is a type-variable: T extends BusinessInterface declared in method findOr(Context,Class,Predicate...) where CAP#1,CAP#2 are fresh type-variables: CAP#1 extends Object super: T from capture of ? super T CAP#2 extends Object super: T from capture of ? super T
I get not errors in Eclipse and I have no idea what is going wrong.
Any help is really appreciated :).