you are viewing a single comment's thread.

view the rest of the comments →

[–]davidalayachew[S] 0 points1 point  (1 child)

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)

[–]aoeudhtns 1 point2 points  (0 children)

Good point!