java.util.function · java.base · since Java 1.8
Predicate
@FunctionalInterface
public interface Predicate<T>T → boolean test, the filter shape. Combines logically with and/or/negate — validation rules as data.
Key methods
boolean test(T t) | The test. |
default Predicate<T> and(p) / or(p) / negate() | Boolean algebra over predicates. |
static <T> Predicate<T> not(Predicate<T>) | Readable negation for method refs (Java 11). |
static <T> Predicate<T> isEqual(Object target) | Equality test. |