Java Version 22 Released |
Written by Nikos Vaggalis |
Thursday, 04 April 2024 |
JDK 22 is not a Long Term Support release, but is one of the regular releases that are scheduled to arrive every six months. Still, it has got a lot to show for itself. This release has got a bit of everything; it is comprised of JEPs in final, preview as well as incubator state. As a refresher a JEP stands for JDK Enhancement Proposal. They are proposals for adding new major features to the JDK. Arriving at a specification from of an initial proposal is an iterative process which also includes Requests For Comments. A proposed feature can concern the addition of something new to the language, like Records or Switch expressions, or to any of the Java APIs. Looking at JEPs can answer a lot of questions, like discovering when a certain feature was introduced or looking at where things are heading in the future. As such, the JEPs this release is about are: 423: Region Pinning for G1 All great but let's examine the most eye catching. 454: Foreign Function & Memory API 447: Statements before super() This is helpful when we need to validate an argument that is passed to a superclass constructor by allowing the inclusion of the validation logic directly in the constructor as: something that results in a more flexible and readable code. Another feature in preview is that of 457: Class-File API, which aims to provide a standard API for working with Java class files. 459: String Templates
And finally JEP 461: Stream Gatherers Stream::gather(Gatherer) is a new intermediate stream operation that processes the elements of a stream by applying a user-defined entity called a gatherer. With the gather operation we can build efficient, parallel-ready streams that implement almost any intermediate operation. Stream::gather(Gatherer) is to intermediate operations what Stream::collect(Collector) is to terminal operations. For instance, a gatherer can transform one input element to one output element until some condition becomes true, at which time it starts to transform one input element to two output elements. That's just a bird's eye view of the new release. In case you want to delve deep as low as the API level, you must check Javaalmanac which lists all the low-level API modifications or additions between JDK versions. In summary, Java is still evolving and this version offers a few more reasons to go for it if you have not already.
More InformationJavaalmanac-New APIs in Java 22 Related ArticlesThe I Programmer Java 2023 Recap
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
Last Updated ( Thursday, 04 April 2024 ) |