Why are there primitive functions like DoubleFunction in Java 8
This issue is related to the fact that primitive types in Java are not unified to be substitutable for Object, and with generic type erasure. Using Function<T, Integer> instead of IntFunction<T> when the last one suffices has 2 disadvantages: Every returned int is boxed – meaning a larger memory footprint; Every returned Integer gets an … Read more