Monday, 25 April 2016

fail-fast vs. fail-safe iterators


fail-fast vs. fail-safe 
iterators
  • fail-fast is the property of all the collection classes in java.util package
  • fail-safe is the property of all the collection classes in java.util.concurrent are fail-safe

Advantage of fail-safe

Fail-safe works with the clone of the underlying collection so, not affected by any modification in the collection
Fail-fast iterators throw a ConcurrentModificationException, while fail-safe iterator never throws such an exception.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.