Due for release in September as the next long-term support version of Oracle’s standard implementation of Java, Java Development Kit (JDK) 21 is beginning to take shape, with sequenced collections and string templates scheduled for release through moment.
Although the JDK 21 release page does not yet list features as of March 3, 2023, two Java enhancement proposals covering these two features have already been designated for JDK 21. Specific proposals include:
- Sequenced collections introduce interfaces to represent collections with a defined finding order. Each collection has well-defined first and second elements, and so on, down to the last element. Uniform APIs are provided to accept the first and last item and process items in reverse order. What motivates the proposal is a situation where the Java collections framework lacks a collection type to represent a sequence of elements with a defined order of occurrence. It also lacks a uniform set of operations that apply to all of these collections. These gaps have been a problem and a source of complaints. The proposal requires defining interfaces for the sequencing of collections, sets, and maps, and adapting this to the existing hierarchy of collection types. All of these new methods have default implementations.
- String templates, which will appear as a preview feature, complement existing Java text blocks and string literals by coupling literal text with embedded processors and expressions to produce specialized results. This API is intended to simplify writing Java programs by making it easier to express strings that include computed values at run time. It promises to improve the readability of expressions, improve program security, maintain flexibility, and simplify the use of APIs that accept strings written in non-Java languages. Enabling the development of non-string expressions derived from the combination of literal text and embedded expressions is also a goal.
As a long-term support (LTS) release, JDK 21 would get five years of Premier support and extended support until September 2031. The current LTS version is JDK 17, released in September 2021. Non-LTS versions, such as JDK 20 release scheduled for March 21 and the current release of JDK 19 receive only six months of Premier support and no extended support.
New versions of Oracle’s standard Java implementation arrive every six months. Other possible features for JDK 21 include all of the incubation and preview features in JDK 20, such as scoping values, registration patterns, and virtual threads. Universal generics and the asynchronous stack trace virtual machine API could also be included.
Copyright © 2023 IDG Communications, Inc.
Be First to Comment