Java Lambda - LongPredicate negate example

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


negate has the following syntax.

default LongPredicate negate()


The following example shows how to use negate.

import java.util.function.LongPredicate;
/*w  w w  .  j a  v  a  2 s  .  c  o m*/
public class Main {

  public static void main(String[] args) {
    LongPredicate i = (l) -> l > 0;

The code above generates the following result.