Java Lambda - IntToDoubleFunction example

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.


  1. IntToDoubleFunction applyAsDouble


The following example shows how to use IntToDoubleFunction.

import java.util.function.IntToDoubleFunction;

public class Main {

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

The code above generates the following result.