logoalt Hacker News

bvrmntoday at 6:37 PM1 replyview on HN

ArrayList is a very generic (pun not intended) structure and could be stretched quite freely in any direction with useful property of owning underlying slice. Like readonly preallocated ArrayList is a thing.


Replies

_bohmtoday at 6:45 PM

That's a good point. Using lockPointers would be a good way to enforce at runtime that your ArrayList is truly read-only.