Session
Pattern Matching in Java ... and why do we need algebraic data types?
Pattern matching is a mechanism to check values against patterns. If a match is found, these values can then be broken down into their constituent parts and thus easily and safely processed further. This concept, which is primarily known from functional programming languages, is thus a very powerful and flexible alternative to classic switch statements or if/else statement cascades. For several years now, the JDK incubator project Amber has been working on the introduction of pattern matching in Java. Some of the implementations have now found their way into the OpenJDK. They promise shorter and more comprehensible source code, which can also be checked for correctness by the compiler. It is easier to read and can therefore be easily maintained and extended.
Accompanied by code examples we will take a closer look at the actual state of pattern matching in Java. You will get to know the new features like Switch Expression, Type/Record Patterns, Sealed Classes as well as Pattern Matching for switch in more detail and learn where they can be usefully applied. Afterward, we will take a look at future alternative pattern types.
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top