In your case, there's no need to iterate through the list, because you know which object to delete. You have several options. First you can remove the object by index (so if you know, that the object is the second list element):

 a.remove(1);       // indexes are zero-based

Or, you can remove the first occurence of your string:

 a.remove("acbd");  // removes the first String object that is equal to the
                    // String represented by this literal

Or, remove all strings with a certain value:

 while(a.remove("acbd")) {}

It's a bit more complicated, if you have more complex objects in your collection and want to remove instances, that have a certain property. So that you can't remove them by using remove with an object that is equal to the one you want to delete.

In those case, I usually use a second list to collect all instances that I want to delete and remove them in a second pass:

 List<MyBean> deleteCandidates = new ArrayList<>();
 List<MyBean> myBeans = getThemFromSomewhere();

 // Pass 1 - collect delete candidates
 for (MyBean myBean : myBeans) {
    if (shallBeDeleted(myBean)) {
       deleteCandidates.add(myBean);
    }
 }

 // Pass 2 - delete
 for (MyBean deleteCandidate : deleteCandidates) {
    myBeans.remove(deleteCandidate);
 }
Answer from Andreas Dolk on Stack Overflow
🌐
W3Schools
w3schools.com › java › ref_arraylist_remove.asp
Java ArrayList remove() Method
If a value is specified and multiple elements in the list have the same value then only the first one is deleted. If the list contains integers and you want to delete an integer based on its value you will need to pass an Integer object.
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-list-remove-methods-arraylist-remove
How To Use remove() Methods for Java List and ArrayList | DigitalOcean
September 9, 2025 - You can use the remove() method to achieve this. Here’s an example: List<Post> posts = new ArrayList<>(); // Assuming posts is populated with user posts // Remove all posts from a banned user String bannedUserId = "bannedUser123"; posts.removeIf(post -> post.getUserId().equals(bannedUserId));
🌐
GeeksforGeeks
geeksforgeeks.org › java › remove-element-arraylist-java
How to remove an element from ArrayList in Java? - GeeksforGeeks
July 23, 2025 - Methods: There are 3 ways to remove an element from ArrayList as listed which later on will be revealed as follows: Using remove() method by indexes(default) Using remove() method by values ·
🌐
How to do in Java
howtodoinjava.com › home › collections framework › java arraylist › remove element(s) from arraylist in java
Remove Element(s) from ArrayList in Java
August 7, 2023 - ArrayList<String> arraylist2 = new ArrayList<>(); //1 - Remove an element from the specified index position arraylist.remove(indexPosition); //2 - Remove the first occurence of element by its value arraylist.remove(element); //3 - Remove all elements of the specified collection from arraylist arraylist.removeAll(Arrays.asList(ele1, ele2, ele3)); //4 - Remove all elements matching a condition arraylist.removeIf(e -> e.contains("temp"));
🌐
Vultr
docs.vultr.com › java › standard-library › java › util › ArrayList › remove
Java ArrayList remove() - Delete Element | Vultr Docs
November 14, 2024 - The remove() method in Java's ArrayList class is a versatile tool used to delete elements from an array list. Whether you need to remove a specific element by value or an element at a particular index, this method provides a straightforward approach.
🌐
Java67
java67.com › 2014 › 03 › 2-ways-to-remove-elementsobjects-from-ArrayList-java.html
2 Ways to Remove Elements/Objects From ArrayList in Java [Example] | Java67
System.out.println("ArrayList Before : " + numbers); // Calling remove(index) numbers.remove(1); //removing object at index 1 i.e. 2nd Object, which is 2 //Calling remove(object) numbers.remove(new Integer(3)); System.out.println("ArrayList After : " + numbers); Output : ArrayList Before : [1, 2, 3] ArrayList After : [1] This time, it works, but I am afraid of lazy developers like me, which take autoboxing for granted. Now let's take a look at removing the object from ArrayList while Iterating over them. You must be familiar with Iterator in Java, before proceeding further.
🌐
TutorialsPoint
tutorialspoint.com › home › java/util › java arraylist remove method
Java ArrayList remove Method
September 1, 2008 - The Java ArrayList remove(int index) method removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
Find elsewhere
🌐
Codecademy
codecademy.com › docs › java › arraylist › .remove()
Java | ArrayList | .remove() | Codecademy
March 21, 2022 - Beginner Friendly.Beginner Friendly17 hours17 hours · An element can be removed from an ArrayList instance by being passed to the .remove() method. It can be referenced either by value ...
🌐
Programiz
programiz.com › java-programming › library › arraylist › remove
Java ArrayList remove()
Become a certified Java programmer. Try Programiz PRO! ... The remove() method removes the single element from the arraylist.
🌐
Coderanch
coderanch.com › t › 750418 › java › Remove-element-ArrayList-List-loop
Remove the element of ArrayList and List in for-loop indexes? (Java in General forum at Coderanch)
Each remove() is moving a bunch of elements by one index position. Lots of unnecessary work. For whatever reason you need to use Java 7... you can still use the method I labeled as Iterator on LinkedList, or make new list. Those still work in JDK 7. I'm sorry if you really really want to use the same ArrayList you started with, but it's just a bad idea under Java 7.
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › java-arraylist-remove-method-example
Java ArrayList remove(int index) Method example
Method remove(int index) is used for removing an element of the specified index from a list. It removes an element and returns the same. It throws IndexOutOfBoundsException if the specified index is less than zero or greater than the size of the list (index size of ArrayList).
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › java-arraylist-removeobject-method-example
Java ArrayList remove(Object obj) Method example
We can remove a specific string from the list using remove() method. import java.util.ArrayList; public class RemoveExample { public static void main(String args[]) { //String ArrayList ArrayList<String> al = new ArrayList<>(); al.add("AA"); al.add("BB"); al.add("CC"); al.add("DD"); al.add("EE"); ...
🌐
How to do in Java
howtodoinjava.com › home › collections framework › java arraylist › java arraylist remove(): remove a single element from list
Java ArrayList remove(): Remove a Single Element from List with Examples - HowToDoInJava
August 7, 2023 - If the list does not contain the element, the list remains unchanged. The remove() method is overloaded and comes in two forms: boolean remove(Object o) – removes the first occurrence of the specified element by value from the list.
🌐
TutorialsPoint
tutorialspoint.com › home › java/util › java arraylist remove object
Java ArrayList Remove Object
September 1, 2008 - ... The following example shows the usage of java.util.ArrayList.remove(object) method. package com.tutorialspoint; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { // create an empty array list ...
🌐
Java67
java67.com › 2015 › 06 › how-to-remove-elements-from-arraylist.html
How to Delete Objects from ArrayList in Java? ArrayList.remove() method Example | Java67
There are actually two methods to remove an existing element from ArrayList, first by using the remove(int index) method, which removes elements with a given index, remember the index starts with zero in ArrayList.
🌐
Coderanch
coderanch.com › t › 778400 › java › Removing-elements-ArrayList
Removing elements from an ArrayList (Beginning Java forum at Coderanch)
Alternatively, some collections support the use of an Iterator which has a remove() method that will remove the current element. ... JavaRanch-FAQ HowToAskQuestionsOnJavaRanch UseCodeTags DontWriteLongLines ItDoesntWorkIsUseLess FormatCode JavaIndenter SSCCE API-17 JLS JavaLanguageSpecification MainIsAPain KeyboardUtility ... kevin Abel wrote:. . . The ArrayList has mostly Ford brand automobiles.