Join Slack
Powered by
Hi all, does anyone know what’s the default max si...
# getting-started
j
Jose Garcia
04/06/2023, 9:51 AM
Hi all, does anyone know what’s the default max size of a MutableList?
s
Sam
04/06/2023, 9:54 AM
Default size is obviously zero, or however many items you put in it — but default
capacity
is most often 10 (e.g.
https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html#ArrayList--
) It shouldn’t normally be important, though…
j
Jose Garcia
04/06/2023, 9:55 AM
sorry I meant max capacity
s
Sam
04/06/2023, 9:56 AM
The max size is somewhat badly defined but is constrained by the max size of the underlying array, which will be close to
Int.MAX_VALUE
(which is about 2 billion)
j
Jose Garcia
04/06/2023, 9:57 AM
Thanks Sam!
2
Views
Open in Slack
Previous
Next