- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Iterator and ListIterator in Java
In this post, we will understand the difference between Iterator and ListIterator.
It helps traverse through a map, list and a set.
Index can’t be obtained with the help of an iterator.
The iterator can’t modify or replace elements of a Collection.
It traverses through elements present in Collection.
This iteration can be done in the forward direction only.
Elements can’t be added, since it would throw ConcurrentModificationException.
Methods of the iterator are ‘next()’, ‘remove()’, ‘hasNext()’.
It helps traverse through a list only.
It can’t traverse through a map and a set.
It can traverse through the elements present in Collection.
The traversal can be done in both forward and backward directions.
Some of the methods of listiterator are ‘nextIndex()’, ‘previousIndex()’, ‘previous()’, ‘next()’.
The elements can be modified or replaced.
Elements can be added to a collection anytime.
- Difference between an Iterator and ListIterator in Java
- Difference between Iterator and Spilt Iterator in Java.
- Iterator vs ListIterator in Java?
- Difference between Iterator and Enumeration in Java
- Difference Between Iterator and Enumeration Interface in Java
- Difference between Python iterable and iterator
- ListIterator in Java
- Iterator in Java
- Difference between Go and Java.
- Difference Between C++ and Java
- Iterator Functions in Java
- Difference between Java and C language
- Difference between ArrayList and CopyOnWriteArrayList in Java
- Difference between HashMap and ConcurrentHashMap in Java