Monday, March 30, 2009

ConcurrentModificationException : JAVA

This exception is thrown when you try to add/remove elements from a list or set or any collection, while accessing it.

Example:

for(string data: list)
{
list.remove(data); //Will throw an  ConcurrentModificationException
}

These are simple things that can be avoided while programming and you can save some time.

No comments: