What is the difference between Iterator and ListIterator?
Iterator is super class of ListIterator
ListIterator is super class of Iterator
you have to use only ListIterator with List always, can't use Iterators
You can use ListIterators on sets
Iterator is the super class of ListIterator.
Here is the difference between them:
1. With iterator you can move only forward, but with List Iterator you can move back word also while reading the elements.
2. With List Iterator you can obtain the index at any point while traversing, which is not possible with iterators.
3. With iterator you can check only for next element available or not, but in list iterator you can check previous and next elements.
4. With list iterator you can add new element at any point of time, while traversing. Not possible with iterator.
5. With list iterator you can modify an element while traversing, which is not possible with iterator.
Back To Top