Now as per SCJP the arraylist max. size should be depending on the size of available memory, but list.getSize() returns an Integer. So is it safe to assume that INTEGER.MAXSIZE
is the max. capacity of array . i.e int Max allowed value
Well, since ArrayList
is backed by an array, its max capacity can't be higher than the max length of an array, which is bound by Integer.MAX_VALUE
(since the index of an array is always an int
).
There is another question with an answer matching your question and also an simple example to test: Do Java arrays have a maximum size?.
There are two limits:
1.- The available memory
2.- The max size of an Integer
But im pretty sure you hit the first before the second limit.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With