Menu Bar

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 14 December 2016

What is the difference between Iterator and ListIterator In Java ?


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


Iterator
ListIterator
Iterator traverses the collection in forward direction.
ListIterator traverses the collection in both the direction i.e. forward and backward.
Iterator can traverse List, Set and Queue Objects.
ListIterator can traverse only List Objects.
Iterator can remove the element while traversing using remove() method.
ListIterator cannot remove the element.
Iterator cannot add new element.
ListIterator can add new element using add(E) or set(E).
Iterator cannot obtain the index, because no such method exits in iterator.
ListIterator can obtain the index of elements using previousIndex(E) or nextIndex(E) methods.

Some Similarities between Iterator and ListIterator are as follows :

Iterator
ListIterator
It is an interface.
It is an interface.
It belongs to Collection framework.
It belongs to Collection framework.
It is used to traverse the collection.
It is used to traverse the collection.
This interface is added from JDK 1.2.
This interface is added from JDK 1.2.


      
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