r/java • • Jan 06 '26

One step closer to Value Classes!

https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
181 Upvotes

118 comments sorted by

View all comments

Show parent comment

9

u/oweiler Jan 06 '26

This is the main benefit of value classes, and that you can encode invariants into the type.

4

u/segv Jan 06 '26

Data normalization (e.g. .trim().toUpperCase(..)) too!