IntToDoubleFunction example

Description

IntToDoubleFunction represents a function that accepts an int-valued argument and produces a double-valued result. This is the int-to-double primitive specialization for Function.

Example

The following example shows how to use IntToDoubleFunction.


import java.util.function.IntToDoubleFunction;
//from   w w  w .  j  a va 2  s.  com
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.