In Java How to remove Elements while Iterating a List, ArrayList? (5 different ways)

In Java How to remove elements from ArrayList while iterating? The list.remove(s) will throws java.util.ConcurrentModificationException, if you remove an item from an ArrayList while iterating it. Let’s get started. Create class: CrunchifyRemoveItemFromList.java We will use below 5 methods to remove an element from ArrayList while iterating it. Method-1: collectionRemoveIf Method Method-2: collectionRemoveIfObjectEquals Method Method-3: collectionteratorRemove … Continue reading In Java How to remove Elements while Iterating a List, ArrayList? (5 different ways)