Java 14

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:

  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.

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.

Well Java 16 got released earlier this month (2 mayor releases a year).
Ubuntu 20.04 “groovy” has openjdk 15.

Please note when codeing you can use Java 15 syntax and compile to Java 11 back for compatibility.
Usually such stuff works quite well with Maven.

Ubuntu 20.04 may have openjdk 15 available, but it’s certainly not the default install; that’s still verison 11, the latest LTS version. Version 17, due out in Q3, should be the next LTS version.