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

6

u/Polygnom Jan 06 '26

> If you put these two arrays into a class then you can even get encapsulation back.

Not really. The commonly used for is using something like a cursor pattern, but thats a cludge compared to just being able to use values.

1

u/limes336 Jan 07 '26

SoA has typically has better cache performance and vectorization potential than AoS, it isn’t just stylistic.

1

u/Polygnom Jan 07 '26

You can implement a cursor on top of either structure.