@ SuppressWarnings ( "unchecked" ) @ SafeVarargs @ Nonnull public static < T > Predicate < T > and ( final Predicate < ? extends T > ... ps ) { return c -> { for ( final Predicate < ? extends T > p : ps ) { if ( ! ( ( Predicate < T > ) p ) . test ( c ) ) { return false ; } } return true ; } ; }
Combines many predicates into a predicate that accepts its input only if it passes all predicates .