

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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.
Iterator
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()’.
ListIterator
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.
- Related Questions & Answers
- 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 Java and JavaScript.
- 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