Java Lambda - ToLongFunction example

ToLongFunction represents a function that produces a long-valued result. This is the long-producing primitive specialization for Function.


  1. ToLongFunction applyAsLong


The following example shows how to use ToLongFunction.

import java.util.function.ToLongFunction;
// w  w  w.j  a  va2 s  .c o  m
public class Main {

  public static void main(String[] args) {
    ToLongFunction<String> i  = (x)-> Long.parseLong(x);

The code above generates the following result.