IntPredicate negate example

Description

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

Syntax

negate has the following syntax.


default IntPredicate negate()

Example

The following example shows how to use negate.


import java.util.function.IntPredicate;
/* www  .ja v a 2 s  .c  o  m*/
public class Main {

  public static void main(String[] args) {
    IntPredicate i = (x)-> x < 0;
    
    System.out.println(i.negate().test(123));

  }
}

The code above generates the following result.