When you iterate over a Collection with an Iterator, and remove elements, you should get a "Modified Concurrent Exception" as the title suggests.
I understand, but I need to loop thru some objects to perform cleanup. As an object cleans up it removes itself from its parent causing the exception.
- type of collection
- size of collection
- usage of collection
My most common collections are:
ArrayList or HashSet with approximately 1-20 elements. There is a fair deal of insert and removal, but getting them is most common ofc.