Menu Bar

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 14 December 2016

What is the difference between Iterator and Enumeration In Java ?


Here we list all the differences between Iterator and Enumeration In Java.

Know Also : Iterator

Iterator
Enumeration
This interface is introduced in JDK 1.2.
This interface is introduced in JDK 1.0.
Iterator is used to traverse the collection object as well as it can modify the collection also using remove() method.
It doesn’t allow doing any modifications.
It is not a legacy interface.
It is a legacy interface that’s why it traverses only legacy class’s i.e Vector, Stack and HashTable.
It is fail-fast in nature that means it can throw ConcurrentModificationException.
It is fail-safe in nature that’s mean it cannot throw any Exception.
Iterator is safe and secure.
Enumeration is not safe and secure due to its fail-safe nature.
Methods : hasNext(), next() and remove().
Methods : hasMoreElements() and nextElement().


     
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.

This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.



Share this Blog with yours Friends !!

No comments:

Post a Comment