Merges a collection of predicates into a single predicate, which requires the subject to match each of the component predicates.
(Iterable<? extends Predicate<? super T>> components)
| 19 | * which requires the subject to match each of the component predicates. |
| 20 | */ |
| 21 | public static <T> Predicate<T> and(Iterable<? extends Predicate<? super T>> components) { |
| 22 | if(components instanceof List && ((List<?>) components).size() == 1) |
| 23 | return ((List<? extends Predicate<? super T>>) components).get(0)::test; |
| 24 | return x -> all(components, i -> i.test(x)); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Merges a collection of predicates into a single predicate, |