Java programming is set to be enhanced with record patterns and array patterns, and pattern matching for switch expressions and statements, although the arrival time of these capabilities remains undetermined.
In an online presentation on March 23, Gavin Bierman, consulting member of the technical staff at Oracle, cited these features as the focus of two JDK (Java Development Kit) enhancement proposals eyed for an upcoming, as-yet-undetermined release of Java, which would include them in a preview stage. The hope is that they would appear in the JDK 17 release planned for September.
Supporting record patterns and array patterns, along with type patterns (from Java 16), in the Java language would significantly enhance the expressiveness and utility of pattern matching, and enable more sophisticated and composable data queries, the draft proposal states. Record patterns, array patterns, and type patterns can be nested, as in patterns within patterns. The syntax or semantics of type patterns would not be changed.