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 expressions, you'll get to know the exciting capabilities that are being added to the Java language.

This chapter didn't include any coding exercises for the reader. The return type of methods doesn't participate in method overloading. Overloaded methods must return in the count or type of their parameters.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.240