A Predicate is a function with single argument and return boolean true or false.predicate can be different datatype.
To create predicate it has Single method.
interface Predicate {
public boolean test(T t);
}
import java.util.function.Predicate;
public class PredcateTest {
public static void main(String[] args) {
Predicate pd = i -> i > 20;
System.out.println("status one :- " + pd.test(15));
System.out.println("status two :- " + pd.test(30));
}
}
Output :-
status one :- false
status two :- true
it is nice details.