To create ArrayList, we can call one of its constructors. Many people refer to ArrayList as dynamic array. An ArrayList can be created with any initial size (default 16), and when we add more items, the size of the arraylist grows dynamically without any intervention by the programmer.
The ArrayList offers to remove this sizing limitation.
Once the size of an array is declared, it is not possible to resize the array without creating a new array. Transient Object elementData //backing arrayĪn array is fixed size data structure where the size has to be declared during initialization. Public class ArrayList extends AbstractList All ArrayList methods access this backing array and get/set elements in the same array.ĪrrayList can be seen as resizable-array implementation in Java. The elements added or removed from arraylist are actually modified in the backing array. It is not possible in sets.ĪrrayList class is implemented with a backing array.