Avoid using java iterator

While iterating, it would keep check the original collection/(the iterator, if its as a snapshot the collection). It would throw ConcurrentModificationException, if detected that the collection is modified.

2 thoughts on “Avoid using java iterator

  1. it is to use Iterator’s remove method rather than collection’s own remove method to avoid ConcurrentModificationException


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s