IntPredicate takes a primitive int directly, so testing many integers avoids the autoboxing overhead a Predicate<Integer> would incur on every call.
IntPredicate isEven = n -> n % 2 == 0;
System.out.println("isEven(4): " + isEven.test(4));
System.out.println("isEven(7): " + isEven.test(7));
isEven(4): true
isEven(7): false
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27