DoubleToIntFunction represents a function that accepts a double-valued argument and produces an int-valued result. This is the double-to-int primitive specialization for Function.
The following example shows how to use DoubleToIntFunction
.
import java.util.function.DoubleToIntFunction; /* ww w. jav a 2s . c o m*/ 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.