DoubleToLongFunction example

Description

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

Example

The following example shows how to use DoubleToLongFunction.


import java.util.function.DoubleToLongFunction;
//from ww w  . j av a2  s .  co  m
public class Main {

  public static void main(String[] args) {
    DoubleToLongFunction dl = (x) -> {return Long.MAX_VALUE - (long)x;};
    System.out.println(dl.applyAsLong(3.14));
  }
}

The code above generates the following result.