IntSupplier getAsInt example
Description
IntSupplier getAsInt gets a result from the functional interface.
Syntax
getAsInt
has the following syntax.
int getAsInt()
Example
The following example shows how to use getAsInt
.
import java.util.function.IntSupplier;
//from w ww . j a va 2s. co m
public class Main {
public static void main(String[] args) {
IntSupplier i = ()-> Integer.MAX_VALUE;
System.out.println(i.getAsInt());
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »