Java AbstractSequentialList | iterator() method Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report AbstractSequentialList iterator() method in Java is used to get an Iterator or List Iterator over a list. It returns an iterator over the elements in this list (in proper sequence). This method overrides iterator() in class AbstractList<E> Syntax: public Iterator<E> iterator() Return Value: This method returns an iterator over the elements in this list (in proper sequence). Below is the code to illustrate iterator() method: Program 1: Java // Java program to demonstrate // iterator() method import java.util.*; public class GfG { public static void main(String[] args) { // Creating an instance of the AbstractSequentialList AbstractSequentialList<Integer> absl = new LinkedList<>(); // adding elements to absl absl.add(5); absl.add(6); absl.add(7); absl.add(2, 8); absl.add(2, 7); absl.add(1, 9); absl.add(4, 10); // Getting Iterator Iterator<Integer> Itr = absl.iterator(); // Traversing elements with help of iterator while (Itr.hasNext()) { System.out.print(Itr.next() + " "); } } } Output: 5 9 6 7 10 8 7 Program 2: Java // Java program to demonstrate // iterator() method import java.util.*; public class GfG { public static void main(String[] args) { // Creating an instance of the AbstractSequentialList AbstractSequentialList<String> absl = new LinkedList<>(); // adding elements to absl absl.add("Geeks"); absl.add("ForGeeks"); absl.add("A"); absl.add("Portal"); absl.add(3, "Computer Science"); absl.add(5, "For Geeks"); // Getting Iterator Iterator<String> Itr = absl.iterator(); // Traversing elements with help of iterator while (Itr.hasNext()) { System.out.println(Itr.next()); } } } Output: Geeks ForGeeks A Computer Science Portal For Geeks Create Quiz Comment B barykrg Follow 0 Improve B barykrg Follow 0 Improve Article Tags : Misc Java Java-Collections Java - util package Java-Functions java-AbstractSequentialList +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