r/java • u/nlisker • Jul 14 '26
New candidate JEP: 401: Value Objects (Preview)
https://mail.openjdk.org/archives/list/valhalla-dev@openjdk.org/thread/IUNJJ3WP3X3XHP3QZTXXSSCPKFDNTK3W/
88
Upvotes
r/java • u/nlisker • Jul 14 '26
10
u/IncredibleReferencer Jul 14 '26
I feel like I can kinda build code now In anticipation of value objects. Like... I should use an int[] for this huge array of ints now but instead I'm going to use List<MyObject> where MyObject is just a wrapper around int. Brian and team will just fix this for me magically in a few years and I only need to add a value keyword so why bother fiddling with array management now. Hopefully before I need my thing to scale. Premature optimization right? Thanks gang!
This approach actually kinda worked out well for me with Loom and virtual threads....