
Java 21 includes ordered collections and string templatesMarch 13, 2023 | |
| The next LTS release of Oracle's Java SE is beginning to take shape. JDK version 21 will include some features such as ordered collections and string templates. | |
| Little by little the contours of the next implementation of Java SE LTS are taking shape. Scheduled for September, Java Development Kit (JDK) 21 will include ordered collections and string templates, among other things. Even though as of March 3, 2023, the JDK 21 release page does not yet mention any features, two Java improvement proposals covering these two features have already been designated for the next iteration. | |
Ordered collections | |
| Ordered collections introduce interfaces to represent collections in a defined encounter order. Each collection has a well-defined set, from the first to the last element. Uniform APIs are provided to accept first and last items and process items in reverse order. The proposal aims to address a situation where the Java collections framework lacks a collection type to represent a sequence of elements with a defined encounter order. | |
| A uniform set of operations that apply to these collections is also lacking. These shortcomings were problematic and aroused criticism. The proposal plans to define sequencing interfaces for collections, sets and maps, and integrate them into the existing hierarchy of collection types. All of these add-on methods have default implementations. | |
The String templates | |
| String templates, which will be released in preview, complement Java's existing string literals and text blocks by coupling literal text with expressions and built-in processors to produce specialized results. This API should simplify the writing of Java programs by making it easier to express strings that include values calculated at runtime. It promises to improve the readability of expressions, strengthen program security, retain flexibility, and simplify the use of APIs that accept strings written in languages other than Java. The goal is also the development of non-string expressions derived from the combination of literal text and embedded expressions. | |
| As an LTS release, JDK 21 will receive five years of Premier support and extended support until September 2031. The current LTS release is JDK 17, released in September 2021. Non-LTS releases, such as the JDK release 20 scheduled for March 21 and the current JDK 19 release, only get six months of Premier support and no extended support. Every six months, Oracle releases new versions of the Java SE implementation. Other possible JDK 21 features include all JDK 20 incubation and preview features, such as Scoped values, Record patterns, and Virtual threads. Universal generics and asynchronous stack tracking VM API might also be included in future JDK. | |
|
dzosoft.com © 2022 - 2026 Author: Ing. A. Nasri. All rights reserved.
We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below. The cookies that are categorised as ”Necessary” are stored on your browser as they are essential for enabling the basic functionalities of the site.
We also use third-party cookies that help us analyse how you use this website, store your preferences,
and provide the content and advertisements that are relevant to you. These cookies will only be stored in your browser
with your prior consent.
You can choose to enable or disable some or all of these cookies but disabling some of them may affect your browsing experience.
By clicking “Accept”, you consent to the use of cookies as described in our
Privacy Policy.
Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.
Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.
Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.