BiPredicate negate example

Description

BiPredicate negate returns a predicate that represents the logical negation of this predicate.

Syntax

negate has the following syntax.


default BiPredicate<T,U> negate()

Example

The following example shows how to use negate.


import java.util.function.BiPredicate;
//from   ww  w.  ja v a2s . c o  m
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.