Fail-fast iterators
"Fail-fast iterator" means that if the collection class is structurally modified at any time after the Iterator is created, in any way except through the Iterator's own remove or add methods, the Iterator will throw a ConcurrentModificationException.
Throwing ConcurrentModificationException is not granted, so you have NOT to relay on it. ConcurrentModificationException is used to show the developer that his/her classes are not synced.
Most ifiterators in Java are fail-fast, these found in classes:
- LinkedList
- ArrayList
- Vector
Fail-safe iterators
Fail-safe iterator doesn't throw any Exception if Collection is modified structurally.