Skip Top Navigation Bar

Accessing and Removing Values from an ArrayList Object

E get (int index)

The method returns the element at index.

Your Turn

Let's try it in the Java Playground.

E remove (int index)

The method removes the element at the given index and returns the element. Any elements to the right of this element are shifted to the left and the size of the ArrayList is decreased by 1.

Your Turn

Let's try it in the Java Playground.

booleam remove (Object o)

The method removes the first occurrence of Object o if it exists and returns true. If Object o does not exist, the ArrayList is unchanged and false is returned.

Your Turn

Let's try it in the Java Playground.

Complete List of ArrayList Tutorials

Resources