JDK 17 – Switch Case Performance

Switch statements in Java have evolved over time. Switch statements supported primitive types at the beginning, then came along String,  now JDK17 stable release is out and we have pattern matching which allows us to pass different object types to the switch statement.

We can now have switch statements like this: (example taken from Oracle JavaSE 17 docs)