Switch Case New JDK Features
Contents
Switch Expression (14 Standard / 13 Preview)
Switch expressions can now return a value. And you can use a lambda-style syntax for your expressions, without the fall-through/break issues.
Java 13:
|
|
Standardised Switch (with Java 14):
|
|
Pattern Matching for switch (17 Preview)
|
|
Now you can pass Objects to switch functions and check for a particular type.