An ArrayList is an object that is used to store a group of the other objects and allows us to do manipulation on these objects one by one. Java ArrayList class basically uses a dynamic array for storing the elements.
The basic features of Java ArrayList class are given below:
The basic features of Java ArrayList class are given below:
- Java ArrayList class can contain duplicate elements to store.
- Java ArrayList class maintains insertion order.
- In Java ArrayList class, the manipulation is slow because there is lot of shifting to be occurred if any element is removed from the array list from any index.Suppose there is an arraylist of 4 elements having indices 0,1,2,3. If we want to delete the element placed at the index no, 1, then there will be shifting of elements from down as all the remaining elements goes up covering all the indices, so this is the reason the manipulation in arraylist is slow.
- Java ArrayList class is non synchronized.It mean that there can be case when there can be multiple threads that can work together to modify the list at same time.