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>
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:
5 9 6 7 10 8 7
Geeks ForGeeks A Computer Science Portal For Geeks
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.