Java Lambda - IntToLongFunction applyAsLong example








IntToLongFunction applyAsLong applies this function to the given argument.

Syntax

applyAsLong has the following syntax.

long applyAsLong(int value)

Example

The following example shows how to use applyAsLong.

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.