All Questions
6 questions
6
votes
1
answer
2k
views
When should I create my own @FunctionalInterface rather than reuse the interfaces defined in java.util.function?
The functional interfaces in java.util.function cover the vast majority of common strategies one might want to apply, but it's also possible to define your own @FunctionalInterface instead. In cases ...
8
votes
0
answers
822
views
What lambda function optimizations, if any, are planned for Java 9 and beyond? [closed]
I'm working on a high-performance project where Java 8's lambda functions are enormously useful. I've found, however, that they're memory inefficient when used en masse. For example, suppose I need to ...
116
votes
3
answers
114k
views
What is the name of a function that takes no argument and returns nothing? [closed]
In Java 8's java.util.function package, we have:
Function: Takes one argument, produces one result.
Consumer: Takes one argument, produces nothing.
Supplier: Takes no argument, produces one result.
.....
11
votes
2
answers
11k
views
Is there any reason not to use Optional as a method argument in the case where you know the argument is something that may or may not be needed?
With Java 8, I've seen more and more articles about the use of Option/Optional. I understand what they trying to represent, and I see many examples of them being used as returns. However what I don't ...
52
votes
7
answers
24k
views
Workaround for Java checked exceptions
I appreciate a lot the new Java 8 features about lambdas and default methods interfaces. Yet, I still get bored with checked exceptions. For instance, if I just want to list all the visible fields of ...
14
votes
1
answer
2k
views
Reasons for removal of function types in Java 8
I have been trying to understand why the JDK 8 Lambda Expert Group (EG) decided not to include a new function type into the Java programming language.
Going over the mailing list I found a thread with ...