LongToIntFunction applyAsInt example

Description

LongToIntFunction applyAsInt applies this function to the given argument.

Syntax

applyAsInt has the following syntax.


int applyAsInt(long value)

Example

The following example shows how to use applyAsInt.


import java.util.function.LongToIntFunction;
//  w w w. jav  a  2s. c o 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.