java tutorial - ListIterator in Java - java programming - learn java - java basics - java for beginners
Learn java - java tutorial - How to use list iterator - java examples - java programs
Java ListIterator :
- Java ListIterator is much the same as an Iterator that is used to iterate elements one-by-one from a List implemented object.
- It is offered since Java 1.2.
- The ListIterator extends Iterator interface.
- It is useful only for List implemented classes.
- Unlike Iterator, It supports all the four operations: CRUD (CREATE, READ, UPDATE and DELETE).
- Unlike Iterator, It also supports both Forward Direction and Backward Direction iterations.
- It is a Bi-directional Iterator.
- It has no current element; its cursor position always lies between the element that will be returned by a call to previous() and the element that will be returned by a call to next().
Syntax:
Parameters:
Name | Description | Type |
---|---|---|
index | index of the first element to be returned from the list iterator (by a call to next) | int |
Return Value :
- A list iterator over the elements in this list (in correct sequence), initial at the specified position in the list