Java ListIterator

Java ListIterator interface belongs to java.util package and extends iterator interface.

ListIterator interface allows us to iterate over collection of different class objects in both forward and reverse direction.

We can traverse all types of lists using List iterator such as ArrayList, Vector, LinkedList etc.

ListIterator supports all types of operations such as read, create, update and remove.




Below ListIterator example shows the capability to iterate over List in both forward and backward direction.

Note: I always try to make things easy and simple, please read comments while reading code snippet will help to understand better.


Below is one more example to update and remove items while iterating through collection. 

In case of Iterator add and update of new element is not allowed.


Difference Between Iterator and ListIterator

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan