Java Lambda - IntToLongFunction example








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

Method

  1. IntToLongFunction applyAsLong

Example

The following example shows how to use IntToLongFunction.

import java.util.function.IntToLongFunction;

public class Main {

  public static void main(String[] args) {
    IntToLongFunction i = (x) -> Long.MAX_VALUE-x;
    System.out.println(i.applyAsLong(2));
  }
}

The code above generates the following result.