descendingIterator() method

descendingIterator() method: The Descending Iterator in Java method of LinkedList class employs to return an iterator over the elements in this LinkedList in reverse sequential order. The descendingIterator returns an iterator with elements and these elements will be returned in order from last to first. It returns the object of the Iterator.

Iterator descendingIterator();
import java.util.Iterator;
import java.util.LinkedList;

public class ExampleOfLinkedList {

	public static void main(String[] args) 
		LinkedList<String> listOfNames = new LinkedList<String>();
		Iterator<String> iterator = listOfNames.descendingIterator();
			System.out.println("List from Name = ";

Output: List from Name = RAVI
List from Name = GOAL
List from Name = JAVA

Leave a Comment

Follow us on Instagram & watch the latest videos on YouTube. Click below social icons to visit our Instagram & YouTube profiles.