Java Lambda - IntPredicate test example








IntPredicate test evaluates this predicate on the given argument.

Syntax

test has the following syntax.

boolean test(int value)

Example

The following example shows how to use test.

import java.util.function.IntPredicate;
/*w ww .j  ava 2 s.  c  o m*/
public class Main {

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

  }
}

The code above generates the following result.