Which functional interface in java.util.function takes one argument and returns a boolean?

The story behind the answer

The java.util.function functional interface that takes one argument and returns a boolean is Predicate.

Predicate<T> represents a boolean-valued test of one input value. Its single abstract method is boolean test(T t), so a predicate can answer questions such as whether a number is positive, a string is empty, or an object matches a condition. Predicates are commonly written with lambda expressions, for example n -> n > 0.

Predicate was introduced as part of Java 8’s functional-interface and lambda-expression features. It includes useful default composition methods: and combines two tests, or accepts either test, and negate reverses the result. These operations allow readable conditions to be assembled without manually creating new classes.

The neighboring interfaces are distinguished by their input and output shapes. Function<T,R> accepts one argument and returns a value of type R; Consumer<T> accepts one argument and returns nothing; Supplier<T> accepts no arguments and supplies a value. Predicate’s defining signature is therefore one input followed by a boolean result. Primitive-specialized forms such as IntPredicate avoid boxing an int.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: