LongPredicate negate example

Description

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

Syntax

negate has the following syntax.


default LongPredicate negate()

Example

The following example shows how to use negate.


import java.util.function.LongPredicate;
//w ww.j  a va  2 s .  c  om
public class Main {

  public static void main(String[] args) {
    LongPredicate i = (l) -> l > 0;
    
    System.out.println(i.negate().test(Long.MAX_VALUE));
  }
}

The code above generates the following result.