r/java • • Jul 14 '26

New candidate JEP: 401: Value Objects (Preview)

https://mail.openjdk.org/archives/list/valhalla-dev@openjdk.org/thread/IUNJJ3WP3X3XHP3QZTXXSSCPKFDNTK3W/
87 Upvotes

45 comments sorted by

View all comments

Show parent comment

1

u/aoeudhtns Jul 15 '26

I was looking into creating some sort of value-string type, but it's hard to determine if there's even a point since String is so heavily optimized already. String deduplication and caching the computed hash code are two good examples.

I suppose if there's any benefit to be had, when Valhalla is sophisticated enough, it will happen to String as it exists today, behind the scenes.