Java / Collections
How Fail Fast Iterator works internally?
To identify the structural modification in the collection, fail-fast iterators use an internal flag called modCount which is updated each time a collection is modified. Fail-fast iterators check this flag while calling next() method to retrieve next value and if it finds that modCount changed after iterator being created, it throws ConcurrentModificationException.
More Related questions...