4 ms·
Which method? Note im talking about the language level array, not ArrayList. Also this was years ago.
by wbl 6y ago
Which method? Note im talking about the language level array, not ArrayList. Also this was years ago.
- int_19h 6y agoJava arrays don't have add() at all - they're fixed-size once allocated. ArrayList etc do have add(), and they implement it by re-allocating the backing array once capacity is exceeded. In practice, you'd use the ArrayList anyway. I don't think it's worthwhile comparing Go and Java "language-only", because the standard library is as much a part of the language definition as the fundamental syntax; indeed, what goes where is largely arbitrary. E.g. maps in Go are fundamental, but the primary reason is that they couldn't be implemented as a library in Go with proper type safety, due to the lack of generics.