Tuesday, August 6, 2013

Concurrent Modification Exception Solution

When you try to add and remove items from the Collection/List then it will throw Concurrent Modification Exception ,to avoid that we need to use below code.
for (Iterator<type> iter = coll.iterator(); iter.hasNext(); )
{
 iter.next();
iter.remove();

}

No comments:

Post a Comment