Java Lambda - IntToDoubleFunction applyAsDouble example








IntToDoubleFunction applyAsDouble applies this function to the given argument.

Syntax

applyAsDouble has the following syntax.

double applyAsDouble(int value)

Example

The following example shows how to use applyAsDouble.

import java.util.function.IntToDoubleFunction;

public class Main {

  public static void main(String[] args) {
    IntToDoubleFunction i = (x) -> {return Math.sin(x);};
    System.out.println(i.applyAsDouble(2));
  }
}

The code above generates the following result.