DoubleToIntFunction applyAsInt example
Description
DoubleToIntFunction applyAsInt
applies this function to the given argument.
Syntax
applyAsInt
has the following syntax.
int applyAsInt(double value)
Example
The following example shows how to use applyAsInt
.
import java.util.function.DoubleToIntFunction;
/* w ww . ja v a 2s .c om*/
public class Main {
public static void main(String[] args) {
DoubleToIntFunction df = (x) -> {return (int)x+2;};
System.out.println(df.applyAsInt(3.14));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »