I am curious about Java-11 in general, but specifically JEP:323 which plans to add the var
declaration to Lambda operation variables.
The motivation behind this feature is discussed nicely here. Consider the following quote from the article:
// #1 - Legal
ITest divide = (@ATest var x, final var y) -> x / y;
/* #2 Modifiers on Old-Style implicit paramaters => Illegal */
ITest divide = (@ATest x, final y) -> x / y;
The usage of the final modifier is clear to me and is in line with immutability best practices.
However, I am not sure about the annotations. What is the great benefit of being able to annotate a lambda implicit parameter?
Can you provide a de-facto, beneficial example of using annotations on a lambda operation variable? Not as a matter of opinion, but as an actual example of code which is more readable or efficient when using this feature.