Remove specific element from ArrayList in Java

In this tutorial, we will learn how to Remove specific element from ArrayList in Java.

ArrayList in Java is a resizable-array implementation of the List interface. ArrayList in Java implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. The ArrayList class extends AbstractList and implements the List interface. ArrayList supports dynamic arrays that can grow as needed.

If we want to remove a specific element from ArrayList in Java, then this class provides remove() method to remove specific element. We will use this method to remove specific element from ArrayList . The syntax of remove() method is:

Syntax of remove() method:

Parameters:
obj – object to be removed from the List if present

Returns:
true if the List contains the specified element

Example:

Output:

Related posts

Leave a Comment