What is difference between Fail Fast and Fail Safe






    This  is  common  interview   question    asked  frequently  in  java  experienced  professional.
   






Fail Fast
 Fail Safe
Fail-Fast iterators doesn’t allow modifications of a collection while iterating over it.
Fail-Safe iterators allow modifications of a collection while iterating over it.

These iterators throw ConcurrentModificationException if a collection is modified while iterating over it.

These iterators don’t throw any exceptions if a collection is modified while iterating over it.

These iterators don’t throw any exceptions if a collection is modified while iterating over it.

They use original collection to traverse over the elements of the collection.

These iterators don’t require extra memory.

These iterators require extra memory to clone the collection
They use original collection to traverse over the elements of the collection
They use copy of the original collection to traverse over the elements of the collection


What is difference between Fail Fast and Fail Safe    What is  difference  between Fail Fast and Fail Safe Reviewed by Mukesh Jha on 4:42 AM Rating: 5

No comments:

Add your comment

All Right Reserved To Mukesh Jha.. Theme images by Jason Morrow. Powered by Blogger.