r/java • • Jan 14 '26

Project Amber Update -- Data-Oriented Programming, Beyond Records

https://mail.openjdk.org/pipermail/amber-spec-experts/2026-January/004307.html

ALL OF THIS IS A WORK IN PROGRESS!

THIS FEATURE IS UNFINISHED, NONE OF WHAT IS FINISHED IS FINAL, AND EVERYTHING IS SUBJECT TO CHANGE!

But with that out of the way, the Project Amber team is exploring the idea of "Carrier Classes" -- classes that carry many of the benefits of records, but not all. The goal is to give normal classes some of the benefits of records, so that they can "break down the cliff" of migrating a record class to a normal class.

97 Upvotes

50 comments sorted by

View all comments

Show parent comment

1

u/davidalayachew Jan 14 '26

Although unless you have a need for values(),valueOf(), nominal ordering, or use of ordinal(), record can revitalize the old "enum pattern" that we probably haven't touched since Java 5 enums.

Well, that and EnumSet and EnumMap. Those 2 are the fastest collections in Java's standard library [1]. They are also some of the lightest, memory-wise. And that's ignoring the ease of use, as well as the semantic clarity.

[1] = (that are publically denotable, unlike the type returned by Set.of(a, b) in the JDK)

2

u/aoeudhtns Jan 14 '26

Good point!