JEP 302: Underscore as enhanced for loop parameter?

Zheka Kozlov orionllmain at gmail.com
Wed Nov 1 12:05:13 UTC 2017


The feature that I have always missed in Java is a possibility to ignore a
parameter in `catch`:

try {
    // code
} (NumberFormatException ignored) {
    // code
}

I think an underscore is a perfect fit for this:

try {
    // code
} (NumberFormatException _) {
    // code
}


More information about the amber-spec-observers mailing list