. What do you mean by fail-fast and fast-safe? What is ConcurrentModificationException?

ArrayList and CopyOnWriteArrayList

  1. fail-fast -> one thread is iterating and another thread modifies the arrayList that time ConcurrentModificationException will be thrown and it is fail-fast.

  2. fail-safe : CopyOnWriteArrayList -> there will be no exception as mentioned in above scenario