Tuesday, October 27, 2015

What is difference between fail-fast and fail-safe?


Iterator fail-safe property work with the clone of underlying collection, hence it’s not affected by any modification in the collection. By design, all the collection classes in java.util package are fail-fast whereas collection classes injava.util.concurrent are fail-safe. 

Fail-fast iterators throw ConcurrentModificationException whereas fail-safe iterator never throws ConcurrentModificationException.

No comments:

Post a Comment