VOOZH about

URL: https://www.geeksforgeeks.org/java/linkedlist-listiterator-method-in-java/

⇱ LinkedList listIterator() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

LinkedList listIterator() Method in Java

Last Updated : 11 Jul, 2025

In Java, the listIterator() method of theLinkedList class returns a ListIterator that allows us to iterate over the elements of the list.

Example:


Output
Geeks For Geeks 

Now there are two versions of listIterator() method i.e. without index and with an index.

1. listIterator() Method with No Parameters

It creates an ListIterator that starts form the beginning of the list.

Syntax:

public ListIterator<E> listIterator()

Return type: It returns a ListIterator that starts from the beginning of the list.

Example: Here, we use listIterator() to iterate over the elements of the list.


Output
Traversing the List from index 0: 
A B C D E 

2. listIterator() Method with an Index

The listIterator(int index) method creates a ListIterator that starts iterating from the specified index in the list.

Syntax:

ListIterator<E> listIterator(int index);

  • Parameter: index: The index form which the iterator will start iterating.
  • Return type: It returns an iterator that starts from the specified index.

Example: Here, we use the listIterator() method to iterate over the elements of the list from the specified index.


Output
Traversing the List forward from index 3: 
400 500 600 700 
Comment