BiPredicate negate returns a predicate that represents the logical negation of this predicate.
negate
has the following syntax.
default BiPredicate<T,U> negate()
The following example shows how to use negate
.
import java.util.function.BiPredicate; /* www.j av a 2 s.c om*/ public class Main { public static void main(String[] args) { BiPredicate<Integer, Integer> bi = (x, y) -> x > y; System.out.println(bi.test(2, 3)); System.out.println(bi.negate().test(2, 3)); } }
The code above generates the following result.