LinkedList descendingIterator() method in Java with Examples
The descendingIterator() method of java.util.LinkedList class is used to return an iterator over the elements in this LinkedList in reverse sequential order. The elements will be returned in order from last (tail) to first (head).
public Iterator descendingIterator()
Return Value: This method returns an iterator over the elements in this LinkedList in reverse sequence.
Below are the examples to illustrate the descendingIterator() method
LinkedList:[A, B, C] Value is : C Value is : B Value is : A
LinkedList:[10, 20, 30] Value is : 30 Value is : 20 Value is : 10
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.