List and Set Collections provide iterators that allow traversing the collection in a sequential manner.The specifications for creating an iterator is provided via the Iterator interface. Iterator takes the place of Enumeration in Java, which has been a part of Java SE since version 1.0. An important difference between Iterator and Enumeration is It...

Read More

The major difference is Iterator provides a remove method while Enumeration does not.So, Enumeration acts like a Read-Only object interface to traverse a collection sequentially. Also, it is more secure to use Iterator with multi-threading because of its fail-fast nature.

Read More

It follows Iterator design pattern. Iterator Pattern is a type of behavioral pattern. The Iterator pattern is one, which allows you to navigate through a collection of data using a common interface without knowing about the underlying implementation. Iterator should be implemented as an interface. This allows the user to implement it anyway its eas...

Read More

Fail-fast Iterators throws ConcurrentModificationException when one Thread is iterating over collection object and other thread structurally modify Collection either by adding, removing or modifying objects on underlying collection. They are called fail-fast because they try to immediately throw Exception when they encounter failure. Click here for...

Read More

FOLLOW US ON LinkedIn



Explore Tutu'rself