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.
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.
it is to use Iterator’s remove method rather than collection’s own remove method to avoid ConcurrentModificationException
LikeLike
it works for sometimes, however from JSR, it is not guaranteed. Adding new element would throw this exception as well.
LikeLike