Java Language Updates
Pattern matching involves testing whether an object has a particular structure, then extracting data from that object if there's a match. You can already do this with Java; however, pattern matching introduces new language enhancements that enable you to conditionally extract data from objects with code that's more concise and robust.
https://docs.oracle.com/en/java/javase/17/language/pattern-matching-instanceof-operator.html