Java Lambda - ToDoubleFunction example

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


  1. ToDoubleFunction applyAsDouble


The following example shows how to use ToDoubleFunction.

import java.util.function.ToDoubleFunction;
//from   w w w .j  a  v a2  s.  c  o m
public class Main {

  public static void main(String[] args) {
    ToDoubleFunction<Integer> i  = (x)-> Math.sin(x);

The code above generates the following result.