Lambda Leftovers

Imagine the convenience of marking unused parameters in a method or lambda expression and not passing any arbitrary values to conform to the syntax. Also, when working with lambdas, imagine the ability to declare a lambda parameter name, without caring whether the same variable name has been used in the enclosing scope or not. This is what lambda leftovers (JEP 302) provide in order to enhance lambdas and method references. Apart from these enhancements, it will also offer better disambiguation of functional expressions in methods (this is marked as optional in the JDK Enhancement Proposal (JEP), as of right now).

In this chapter, we'll cover the following topics:

  • Using underscores for unused method parameters
  • Shadowing lambda parameters
  • Disambiguation of functional expressions
..................Content has been hidden....................

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