ToLongFunction example
Description
ToLongFunction represents a function that produces a long-valued result. This is the long-producing primitive specialization for Function.
Example
The following example shows how to use ToLongFunction
.
import java.util.function.ToLongFunction;
/*from ww w . j a v a 2 s. c om*/
public class Main {
public static void main(String[] args) {
ToLongFunction<String> i = (x)-> Long.parseLong(x);
System.out.println(i.applyAsLong("2"));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »