Inserting into an ArrayList

There are four ways to add elements in an ArrayList:

Inserting a single element at the end

To add a single element at the end of the List, the add(E e) method can be used, where E refers to any type of object. This method will check if there is sufficient capacity in the ArrayList. If the ArrayList is full, then it will resize it and insert the element at the end.