According to these questions from SO:
The max length of an array is Integer.MAX_VALUE - 5
,
whereas the max size of a List
is Integer.MAX_VALUE
When you look at an ArrayList
, it is just a wrapper around an array.
How can the wrapper allow a length longer than that of the array under the hood?