Java Lambda - DoublePredicate test example








DoublePredicate test evaluates this predicate on the given argument.

Syntax

test has the following syntax.

boolean test(double value)

Example

The following example shows how to use test.

import java.util.function.DoublePredicate;
// ww  w .  j ava2s  .  c om
public class Main {

  public static void main(String[] args) {
    DoublePredicate dp = (d) -> d > 0;

    System.out.println(dp.test(0.5));

  }
}

The code above generates the following result.