DoubleFunction example

Description

DoubleFunction represents a function that accepts a double-valued argument and produces a result. This is the double-consuming primitive specialization for Function.

Example

The following example shows how to use DoubleFunction.


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

  public static void main(String[] args) {
    DoubleFunction<String> df = (d) -> d +" is now a string";

    System.out.println(df.apply(0.5));

  }
}

The code above generates the following result.