ConcurrentModificationException

Getting this error ?

java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
at java.util.AbstractList$Itr.next(AbstractList.java:420)
This exception might be happened because of:

1. Doing an iteration over a collection that is being modified during the loop. For example:
for (Object object: list) {
list.remove(object);
}
2. Modifying the list at the same time (because List isn't thread safe). It can only happen either when the list object was declared static or singleton, or it's owned by a static or singleton object.

0 comments: (+add yours?)