DoubleFunction apply example

Description

DoubleFunction apply applies passed-in function to the given argument.

Syntax

apply has the following syntax.


R apply(double value)

Example

The following example shows how to use apply.


import java.util.function.DoubleFunction;
/* w  ww . ja  va2s. c om*/
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.