Java Lambda - LongToDoubleFunction example








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

Method

  1. LongToDoubleFunction applyAsDouble

Example

The following example shows how to use LongToDoubleFunction.

import java.util.function.LongToDoubleFunction;
// w w w  .  j  a v a 2  s . com
public class Main {

  public static void main(String[] args) {
    LongToDoubleFunction i = (l) -> Math.sin(l);
    
    System.out.println(i.applyAsDouble(Long.MAX_VALUE));
  }
}

The code above generates the following result.