ArrayList class

ArrayList comes in collection framework since JDK 1.2. It extends AbstractList class and implements List interface. It stores the data in dynamic array format. ArrayList is basically used where a lots of array manipulations are required.

Features of ArrayList
1. ArrayList allows us to randomly access the list elements.
2. ArrayList can not work or used for primitive data types, like int, float, char etc. We need a wrapper class in place of primitive data types.
3. It’s size can be initialized and in case if elements grows, its size can increase or shrunk if elements removed from the list.
4. ArrayList cam contain duplicate elements and also maintains the insertion order.
5. ArrayList class is non synchronized by nature.
6. In ArrayList, manipulation is quite slow as lot of shifting is required.

1. public ArrayList()
This constructor is used for creating an empty ArrayList.

2. public ArrayList(int apacity)
This constructor is used to describe an array that has the specified capacity.

3. public ArrayList(Collection collection)
This constructor is used to describe an array that is initialized with the elements of the given collection.

ArrayList class hierarchy
public class ArrayList extends AbstractList implements List