Re:Java 14 Feature Spotlight: Records
by dajohnson89 on Tuesday February 04, 2020 @11:58PM
(#22244155)
I always thought array elements were contiguous in memory? Is it that the objects are contiguous, but the pointers are not? If so, this does seem pretty expensive and I wonder if there's any workarounds.
[ Parent
| on HN ]
Re:Java 14 Feature Spotlight: Records
by touisteur on Wednesday February 05, 2020 @03:21AM
(#22244947)
Well arrays if elementary types are contiguous, yes. Arrays of objects are arrays of references to instances. The references are contiguous, but they point to instances all over the place.
Re:Java 14 Feature Spotlight: Records
by dajohnson89 on Thursday February 06, 2020 @01:30PM
(#22258731)
that makes perfect sense, thank you