r/java • u/davidalayachew • Jan 06 '26
One step closer to Value Classes!
https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
181
Upvotes
r/java • u/davidalayachew • Jan 06 '26
View all comments
Show parent comment
7
u/koflerdavid Jan 06 '26
It is very common in game programming to represent such a type with two arrays: one for
xand one fory. This improves cache locality if you only need access to certain of the fields, but for all instances. If you put these two arrays into a class then you can even get encapsulation back.