PrepZone Logo
PrepZone
Back to Java

Java · Medium

Differentiate between fail-fast and fail-safe iterators.

JavaCollections

Answer preview

Fail-fast — Throws ConcurrentModificationException if the collection is structurally modified during iteration. Uses an internal modCount field. Examples: iterators of ArrayList, HashMap, HashSet.…