What is fail-fast iterator in Java? What is it used for? The unsynchronized collections and their modifications, iterations are termed as ‘fail-fast’ iterators. An iterator that implements Iterable interface and looping through it will create an iterator. This iterator returns the iterator method of this class, which named as ‘fail-fast’ if, the given set is updated at any given point of time after the creation of the iterator, through the iterator’s remove method and throws a ConcurrentModificationException.
|