Re:Garbage Collectors Are Scary
by kaba0 on Sunday May 12, 2024 @01:45PM
(#40336154)
This is solved through generics. List<T> will be invariant.
[ Parent
| on HN ]
I can’t remember the last time I wrote a raw array. There’s absolutely no reason for it.
"Absolutely no reason" is wrong, "almost certainly no reason for most programs" is more accurate. You'll need arrays of you're writing buffers, various types of collections (B-trees, hashtables), etc.
Well, while I do agree with you (I would even add performance-sensitive code to your list. Something like int[] applied at the correct places can do a lot), if we want to be absolutely nitpicky one can just use ByteBuffers over arrays for pretty much everything.