Spare keystrokes with the record keyword | Modern Java | JDK 16 | Head Crashing Informatics 26

Hey guys! How’s it going?

The record keyword is ready for production use in JDK 16, which officially will be here mid March. Spare lots of keystrokes and get rid of code generators and IDE magic with this new keyword!

In addition to spare typing, your Java source code also is getting much easier to maintain and to understand, as it is so concise and fully integrated into the compiler and the runtime. While, besides of shorter source code, there is no measurable speed gain or reduced binary footprint currently, I could imagine that in future the runtime could further optimize records, as it knows that records are definitively immutable and non-extensible.

Maybe project Valhalla will then treat them as primary data types, as they already are best suited for passing around pure values — so your code would run in double speed consuming half the memory?

Secure a headstart: Use Java 16 NOW!

Project Valhalla:

Valhalla change log:

Stay safe and… Party on!

About Markus Karg

Java Guru with +30 years of experience in professional software development. I travelled the whole world of IT, starting from Sinclair's great ZX Spectrum 48K, Commodore's 4040, over S/370, PCs since legendary XT, CP/M, VM/ESA, DOS, Windows (remember 3.1?), OS/2 WARP, Linux to Android and iOS... and still coding is my passion, and Java is my favourite drug!
This entry was posted in Jakarta EE, Java, Programming, Standards and tagged , , , , , , , . Bookmark the permalink.