Java AbstractSequentialList | iterator() method Last Updated : 26 Nov, 2018 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 Comment More infoAdvertise with us Next Article Java AbstractSequentialList | iterator() method B barykrg Follow Improve Article Tags : Misc Java Java-Collections Java - util package Java-Functions java-AbstractSequentialList +2 More Practice Tags : JavaJava-CollectionsMisc Similar Reads AbstractSequentialList get() method in Java with Examples The get() method of AbstractSequentialList is used to fetch or retrieve an element at a specific index from a AbstractSequentialList. Syntax: AbstractSequentialList.get(int index) Parameters: The parameter index is of integer data type that specifies the position or index of the element to be fetche 2 min read Java AbstractSequentialList | add() AbstractSequentialList uses the add() method specified by the List interface and overridden in class AbstractList. Hence AbstractSequentialList do not have a add() method of its own. Instead it has add(int index, E element) method. AbstractSequentialList add(int index, E element) method inserts the 3 min read AbstractSequentialList set() method in Java with Examples The set() method of Java.util.AbstractSequentialList is used to replace any particular element in the sequential list created using the LinkedList class with another element. This can be done by specifying the position of the element to be replaced and the new element in the parameter of the set() m 3 min read Java AbstractSequentialList | ListIterator() AbstractSequentialList listIterator(): method in Java is used to get a listIterator over this list. It returns a list iterator over the elements in this list (in proper sequence). Syntax: public abstract ListIterator listIterator(int index) Parameters: This method takes a parameter index which is th 2 min read ArrayDeque iterator() Method in Java The Java.util.ArrayDeque.iterator() method is used to return an iterator of the elements of the ArrayDeque. Syntax: Iterator iterate_value = Array_Deque.iterator(); Parameters: The method does not take any parameter. Return Value: The method iterates over the elements of the deque and returns the va 2 min read Like