In Java, is there a short elegant way to combine multiple predicates (Guava Predicate) into one?
Currently, I have some list of predicates:
Collection<Predicate<TypeA>> preds = ...;
And I have some code that loops through the predicates and returns false if any one of them are false. Is there a one-liner that accomplishes the same thing?
If you're using Guava, it looks like Predicates#and
will do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With