ToDoubleFunction example

Description

ToDoubleFunction represents a function that produces a double-valued result. This is the double-producing primitive specialization for Function.

Example

The following example shows how to use ToDoubleFunction.


import java.util.function.ToDoubleFunction;
//  w  w  w  . j a  v  a  2s.  co m
public class Main {

  public static void main(String[] args) {
    ToDoubleFunction<Integer> i  = (x)-> Math.sin(x);
    
    System.out.println(i.applyAsDouble(Integer.MAX_VALUE));
  }
}

The code above generates the following result.