Common Methods in ArrayList
Methods
Description
✅ add(E e) Adds an element to the end of
the list.
✅ add(int index, E e) Adds an element at a specific
index.
✅ get(int index) Retrieves the element at the specified
index.
✅ set(int index, E e) Replaces an element at a given
index.
✅ remove(int index) Removes the element at the given
index.
✅ size() Returns the number of elements
in the list.
✅ contains(Object o) Checks if an element is in the
list.
✅ indexOf(Object o) Returns the index of the first
occurrence of the element.
✅ isEmpty() Returns true if the list is
empty.
✅ clear() Removes all elements from the
list.