DoubleToLongFunction applyAsLong example
Description
DoubleToLongFunction applyAsLong applies the functional interface to the given argument.
Syntax
applyAsLong
has the following syntax.
long applyAsLong(double value)
Example
The following example shows how to use applyAsLong
.
import java.util.function.DoubleToLongFunction;
/*from ww w. j a v a 2 s . c o 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.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »