LongToIntFunction example
Description
LongToIntFunction represents a function that accepts a long-valued argument and produces an int-valued result. This is the long-to-int primitive specialization for Function.
Example
The following example shows how to use LongToIntFunction
.
import java.util.function.LongToIntFunction;
/*w w w . ja v a 2 s. co m*/
public class Main {
public static void main(String[] args) {
LongToIntFunction i = (l) -> (int)l;
System.out.println(i.applyAsInt(Long.MAX_VALUE));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »