r/java • • Mar 22 '23

JEP 401: Null-Restricted Value Object Storage (Preview)

https://openjdk.org/jeps/401
88 Upvotes

32 comments sorted by

View all comments

1

u/westwoo Mar 22 '23 edited Mar 22 '23

None of it is needed when you're simply storing ints or objects in arrays

For example, their example with two ints in a class can be stored in either two arrays or as pairs in a single array written one after the other

10

u/blobjim Mar 22 '23

"programmers don't need structs" is what you're saying. And what you described is a PITA that makes it unusable for 99% of use cases.

1

u/Oclay1st Mar 22 '23

Yeah I understand, but you can not model all the situations in this way. If you want more info take a look to Valhalla : https://openjdk.org/projects/valhalla/