I have a basic question on Java ArrayList
.
When ArrayList
is declared and initialized using the default constructor, memory space for 10 el
Default capacity of ArrayList is 10. Once the Capacity reaches its maximum capacity, Size of the ArrayList will be 16, once the capacity reaches its maximum capacity of 16, size of the ArrayList will be 25 and keep on increasing based on Data size.....
How? Here is the Answer and Formula
New capacity = (Current Capacity * 3/2) + 1
So, if the default capacity is 10, then
Current Capacity = 10
New capacity = (10 * 3/2) + 1
Output is 16