What are difference between Iterator and ListIterator?
Following are some difference as :
Iterator |
ListIterator |
1 Use Iterator to traverse Set, List and also Map Objects. |
1 Use ListIterator to traverse list objects. |
2 Iterator iterate elements of collection in the forward
direction only. |
2 ListIterator iterate elements of collection in the forward
and backward direction. |
3 Iterator cannot add elements to collection. |
3 ListIterator can add elements to collection. |
4 Iterator can't replace existing object with new object. |
4 ListIterator can replace existing object with new object. |
5 Iterator can't get index of elements. |
5 ListIterator get index of elements list. |
Read More →