Create account / Log in

Java 14

Discussion area for the development team.

Moderators: uckelman, Tim M

Java 14

Postby Flint1b » July 31st, 2020, 9:48 pm

Can we switch to Java 14? I know it's not an LTS release but I already love the new switch statement, just look at this beauty:

Code: Select all
  private static char indexToCharacter(int row) {
    return switch (row) {
      case 0 -> 'a';
      case 1 -> 'b';
      case 2 -> 'c';
      case 3 -> 'd';
      default -> throw new IllegalStateException("Unexpected value: " + row);
    };
  }


No break necessary, no intermediary variable, just return the switch.
User avatar
Flint1b
 
Posts: 402
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Java 14

Postby uckelman » July 31st, 2020, 10:04 pm

Thus spake Flint1b:
> Can we switch to Java 14? I know it's not an LTS release but I already
> love the new switch statement, just look at this beauty:

We're going to have Linux users on Java 11 for a while I expect. The
thing to watch is what Ubuntu ships for its own LTS release.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8789
Joined: December 10th, 2007, 9:48 am
Location: Durham, England


Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests