Java Lambda - DoublePredicate example

DoublePredicate represents a predicate, which is a boolean-valued function, of one double-valued argument. This is the double-consuming primitive type specialization of Predicate.


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


The following example shows how to use DoublePredicate.

import java.util.function.DoublePredicate;
//from   w w w. j  a v a2s  .com
public class Main {

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



The code above generates the following result.