Is Java 14 worth exploring?

I've heard it features some new things but purely experimental / preview...also is it worth using versions of Java that don't offer LTS?



Java 14 has some features that are worth exploring...most of the improvements seek to reduce the overall verbosity of Java. For example pattern matching allows you to simultaneously type check a value and conditionally bind it to variables without all of the boilerplate code...

  1. if (obj instanceof String s) {
  2. // can use s here
  3. } else {
  4. // can't use s here
  5. }

see how that saves you some boilerplate...?

also switch statements are easier to use with 14:

  1. switch (day) {
  2. case MONDAY -> System.out.println("Monday");
  3. case TUESDAY, WEDNESDAY -> System.out.println("Hump days");
  4. case THURSDAY -> System.out.println("Almost Friday");
  5. case FRIDAY -> System.out.println("Friday");
  6. case SATURDAY, SUNDAY -> System.out.println("The weekend");
  7. }

again this is just like "Syntactic sugar"...

it's also worth mentioning that java 14 DOES NOT offer long term support (LTS)..this means you are crazy to use Java 14 (and any of it's experimental/preview features) in a production environment. these features are meant to be used experimentally and feedback is actively being submitted against these new features.


java 14 also has some solid new support for garbage collection specifically utilizing NUMMA etc...