ConcurrentModificationException during removal

Tags

, ,

links:
https://dzone.com/articles/removing-entries-hashmap
http://www.benchresources.net/map-how-concurrentmodificationexception-can-be-handled-in-java/

summary:
– removing an element from a HashMap could throw ConcurrentModificationException if not done properly
– not necessarily thread issue
– problem is element list changed during iteration
– solution is to use ConcurrentHashMap or use iterator to remove

Advertisements