How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
This question already has answers here: Iterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop (31 answers) Closed 8 years ago. I’m trying to remove some elements from an ArrayList while iterating it like this: for (String str : myArrayList) { if (someCondition) { myArrayList.remove(str); } } Of course, I get a […]