Fail-Fast and Safe

Fail-Fast Iterators fail as soon as they realized a thread is iterating over it,Structure of Collection has been changed since iteration has begun

Structural changes like Create,Update,Delete

Fail-Fast collections throw throws ConcurrentModificationException
Whereas,Iterator do not throw any Exception if collection is modified structurally,as they work on clone of collection instead of original collection.

Which all are fail-safe collections?

  • CopyOnWriteArrayList
  • ConcurrentHashMap