Here we list all the differences and similarities between Iterator and ListIterator In Java.
Know Also : Collection Framework / Collection Interface / Iterator Interface
Iterator
|
ListIterator
|
Iterator traverses the collection in forward
direction.
|
ListIterator traverses the collection in both the
direction i.e. forward and backward.
|
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).
|
ListIterator can obtain the index of elements
using previousIndex(E) or nextIndex(E) methods.
|
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.
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.


No comments:
Post a Comment