Iterate a LinkedList in Reverse Order in Java Last Updated : 28 Jan, 2021 Comments Improve Suggest changes 1 Likes Like Report For traversing a linked list in reverse order we can use Descending Iterator or List Iterator 1. Descending Iterator Syntax: LinkedList<String> linkedlist = new LinkedList<>(); Iterator<String> listIterator = linkedlist.descendingIterator(); Returns: Descending Iterator returns the Iterator that points to the end of the linked list. 2. List Iterator Syntax: LinkedList<String> linkedlist = new LinkedList<>(); ListIterator<String> listIerator = linkedlist.listIterator(linkedlist.size()); Parameter: the size of the linked list, this will make the iterator point at the end of the linked list. Example 1: Using descending Iterator Java // Java program to Iterate a LinkedList in Reverse Order // using descending Iterator import java.util.Iterator; import java.util.LinkedList; public class GFG { public static void main(String[] args) { LinkedList<String> linkedList = new LinkedList<>(); // adding elements to linked list linkedList.add("Geeks"); linkedList.add("For"); linkedList.add("Geek"); linkedList.add("2020"); linkedList.add("2021"); // getting an iterator which points at the // end of the linkedlist Iterator<String> iterator = linkedList.descendingIterator(); // traversing the linkedlist // hasNext() will tell if previous element is // available or not // next() with descending iterator will return the // previous element // and after getting the previous element // is moves the cursor to next previous element. while (iterator.hasNext()) { System.out.println(iterator.next()); } } } Output2021 2020 Geek For Geeks Example 2: Using List Iterator Java // Java program to Iterate a LinkedList in Reverse Order // using List Iterator import java.util.LinkedList; import java.util.ListIterator; public class GFG { public static void main(String[] args) { LinkedList<String> linkedList = new LinkedList<>(); // adding elements of to the linkedlist linkedList.add("Geeks"); linkedList.add("For"); linkedList.add("Geek"); linkedList.add("2020"); linkedList.add("2021"); // getting an iterator that points at the end of the // linkedlist ListIterator<String> listIterator = linkedList.listIterator(linkedList.size()); // Traversing the linked list // hasPrevious() function to check if previous // element is present or not previous() function to // get the previous element and after getting // previous elements it move the cursor to the next // previous element while (listIterator.hasPrevious()) { System.out.println(listIterator.previous()); } } } Output2021 2020 Geek For Geeks Create Quiz Comment L le0 Follow 1 Improve L le0 Follow 1 Improve Article Tags : Java Technical Scripter Java Programs Technical Scripter 2020 Java-Collections java-LinkedList +2 More Explore Java BasicsIntroduction to Java3 min readJava Programming Basics9 min readJava Methods6 min readAccess Modifiers in Java4 min readArrays in Java7 min readJava Strings7 min readRegular Expressions in Java3 min readOOP & InterfacesClasses and Objects in Java5 min readAccess Modifiers in Java4 min readJava Constructors4 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages2 min readJava Interface7 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java4 min readIterator in Java4 min readJava Comparator Interface5 min readException HandlingJava Exception Handling6 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java7 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking6 min readJDBC Tutorial5 min readJava Memory Management3 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples7 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz1 min readJava Project Ideas For Beginners and Advanced15+ min read Like