In Java programming, a function is proposed to improve the pattern matching of record patterns, sequence patterns and switch expressions and statements. However, it has not been decided when these features will be supported.
In an online presentation on March 23, Gavin Beerman, Oracle’s technical consulting manager, addressed these features with the unveiling of two Open JDK project proposals. These will be included in the preview phase in the upcoming (but not exactly determined) Java release. It is expected to be included in the JDK17 release scheduled for September this year.
According to the draft proposal Supporting record formats and array formats in Java (supported by Java 16) along with typing patterns greatly improves the expression and effect of pattern matching and allows for more advanced and configurable data queries. Record patterns, sequence patterns and type patterns can be nested as samples in a sample. The syntax or economics of the type model does not change.
Pattern matching is a method that allows the general logic of a program, i.e. the conditional extraction of parts from an object. The proposal was published in JDK16 on March 16. Example He explained that the operator expanded to take the type pattern and match the pattern. This is a record sample and range sample proposal ExampleIt is based on the sample matching of (JEP 394).
Meanwhile, according to the draft proposal that increased the sample matching for the switch, You can use this to test expressions against multiple models, each with a specific function, so you can express complex data-based queries safely and concisely.
The purpose of this proposal is to expand the expression and application of switch expressions and syntax by displaying them on the case label and minimizing null-hostility if desired.
In addition, the draft proposal explains that it introduces new models embedded in parentheses and protected models that improve model matching logic with arbitrary Boolean expressions. Existing switch expressions are compiled without modification and run with the same semantics.
So far, officially known features will be released in JDK17 Improved Pseudorandom Number Generator (PRNG)Wow New Makos Rendering PipelineShould be. More features will be proposed in JDK17 in the coming months. email@example.com