0% found this document useful (0 votes)
31 views1 page

Array List Methods

The document outlines common methods used in an ArrayList, including adding, retrieving, replacing, and removing elements. It also describes methods for checking the size, contents, and emptiness of the list. Each method is accompanied by a brief description of its functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Array List Methods

The document outlines common methods used in an ArrayList, including adding, retrieving, replacing, and removing elements. It also describes methods for checking the size, contents, and emptiness of the list. Each method is accompanied by a brief description of its functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

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.

You might also like