java.util.ConcurrentModificationException

This post shows show to solve the problem of java.util.ConcurrentModificationException for ArrayList. The error message looks like the following: Exception in thread “main” java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) … … The Problem You may want to iterate through an ArrayList, and delete some element under some certain condition. For example, the following code … Read more