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).
public abstract ListIterator listIterator(int index)
Parameters: This method takes a parameter index which is the index of first element to be returned from the list iterator (by a call to the next method)
Returns: This method returns a list iterator over the elements in this list (in proper sequence).
Exceptions: This method throws IndexOutOfBoundsException, if the index is out of range (index size())
Below is the code to illustrate ListIterator():
6 7 10 8 7
Program 2: To demonstrate IndexOutOfBoundException
[5, 9, 6, 7, 10, 8, 7] Exception: java.lang.IndexOutOfBoundsException: Index: 15, Size: 7
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Retrieving Elements from Collection in Java (For-each, Iterator, ListIterator & EnumerationIterator)
- LinkedList listIterator() Method in Java
- ArrayList listIterator() method in Java with Examples
- AbstractList listIterator() Method in Java with Examples
- Stack listIterator(int) method in Java with Example
- Stack listIterator() method in Java with Example
- Vector listIterator() method in Java with Examples
- List listIterator() Method in Java with Examples
- Difference between an Iterator and ListIterator in Java
- Enumeration vs Iterator vs ListIterator in Java
- ListIterator in Java
- CopyOnWriteArrayList listIterator() method in Java
- Java AbstractSequentialList | iterator() method
- Java AbstractSequentialList | add()
- AbstractSequentialList set() method in Java with Examples
- AbstractSequentialList addAll() Method in Java with Examples
- AbstractSequentialList remove() method in Java with Examples
- AbstractSequentialList get() method in Java with Examples
- AbstractSequentialList isEmpty() method in Java with Example
- AbstractSequentialList removeAll() method in Java with Example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.