March 2019
Intermediate to advanced
242 pages
6h 21m
English
Using an underscore to mark unused parameters required changes in the Java language.
Until Java 8, the underscore was used as a valid identifier. The first step was to deny permission to use an underscore as a regular identifier. So, Java 8 issued a compiler warning for the usage of _ as the name of formal parameters in lambdas. This was simple, and had no backward-compatibility issues since lambdas were introduced in Java 8. Moving forward, Java 9 replaced the compiler warning message with compilation errors for using underscores as parameter names.
With JEP 302, developers can use _ to mark an unused method parameter for the following:
In the next section, you'll see how (in ...
Read now
Unlock full access