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
- CopyOnWriteArrayList listIterator() method in Java
- LinkedList listIterator() Method in Java
- Stack listIterator(int) method in Java with Example
- Stack listIterator() method in Java with Example
- Difference between an Iterator and ListIterator in Java
- Vector listIterator() method in Java with Examples
- ArrayList listIterator() method in Java with Examples
- List listIterator() Method in Java with Examples
- AbstractList listIterator() Method in Java with Examples
- Retrieving Elements from Collection in Java (For-each, Iterator, ListIterator & EnumerationIterator)
- Java AbstractSequentialList | add()
- AbstractSequentialList contains() method in Java with Example
- AbstractSequentialList in Java with Examples
- AbstractSequentialList set(int, Object) method in Java with Example
- AbstractSequentialList conatinsAll() 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.