Java Lambda - LongPredicate example








LongPredicate represents a predicate (boolean-valued function) of one long-valued argument. This is the long-consuming primitive type specialization of Predicate.

Method

  1. LongPredicate test
  2. LongPredicate and
  3. LongPredicate negate
  4. LongPredicate or




Example

The following example shows how to use LongPredicate.

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

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

The code above generates the following result.