Summary
For Java developers working with lambdas and method references, this chapter demonstrates what Java has in the pipeline to help ease problems.
Lambda Leftovers (JEP 302) proposes using an underscore for unused parameters in lambdas, methods, and catch handlers. It plans to allow developers to define lambda parameters that can overshadow variables with the same name in their enclosing block. The disambiguation of functional expressions is an important and powerful feature. It will allow compilers to consider the return types of lambdas in order to determine the right overloaded methods. Since it can affect how the compilers work, this feature is marked as optional in this JEP.
In the next chapter, which is on pattern matching and switch ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access