New answers tagged

2

Arrays are very low level. You could as well ask, "In java why are int, float, and double not objects, to make them more consistent with the rest of the object-orientated language?" Arrays have a close mapping (in most languages) to the assembly level memory code. This has no real notion of generics, arrays are of pointers or other primitive types. Arrays ...


5

In Java, there is no Array type collection to make arrays feel more consistent, such as in inheritance. Sure there is, it's called List<T>. The only fundamental difference between a hypothetical Array<T> and List<T> is that you can't resize the Array<T>. If Array<T> were added it would be just like List<T> except with ...


3

Regarding Java, Java 1.0 didn't have generics. On the contrary, I'd argue arrays are "first-class citizens" in Java since they're given special treatment by the language. It's true that sometimes you simply need a fixed-size collection, but the case where you need a dynamically-sized collection is more common. Finally, arrays are fine for temporary usage ...



Top 50 recent answers are included