3 ms·
This is solved through generics. List<T> will be invariant.
by kaba0 2y ago
This is solved through generics. List<T> will be invariant.
- vips7L 2y agoI can’t remember the last time I wrote a raw array. There’s absolutely no reason for it.
- naasking 2y ago"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.
- kaba0 2y agoWell, 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.
- vips7L 2y agoOf course if you want to be pedantic. But no one is writing these. 99% of all code is going to use collections from the standard library.