Class ListIteratorImpl<E>
- java.lang.Object
-
- org.pepstock.charba.client.commons.IteratorImpl<E>
-
- org.pepstock.charba.client.commons.ListIteratorImpl<E>
-
- Type Parameters:
E
- type of list
- All Implemented Interfaces:
Iterator<E>
,ListIterator<E>
public final class ListIteratorImpl<E> extends IteratorImpl<E> implements ListIterator<E>
An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E e)
Inserts the specified element in the listboolean
hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the forward direction.int
nextIndex()
Returns the index of the element that would be returned by a subsequent call tonext()
.E
previous()
Returns the previous element in the list and moves the cursor position backwards.int
previousIndex()
Returns the index of the element that would be returned by a subsequent call toprevious()
.void
set(E e)
Replaces the last element returned by next() or previous() with the specified element .-
Methods inherited from class org.pepstock.charba.client.commons.IteratorImpl
hasNext, next, remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Methods inherited from interface java.util.ListIterator
hasNext, next, remove
-
-
-
-
Method Detail
-
hasPrevious
public boolean hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the forward direction.- Specified by:
hasPrevious
in interfaceListIterator<E>
-
nextIndex
public int nextIndex()
Returns the index of the element that would be returned by a subsequent call tonext()
.- Specified by:
nextIndex
in interfaceListIterator<E>
-
previousIndex
public int previousIndex()
Returns the index of the element that would be returned by a subsequent call toprevious()
.- Specified by:
previousIndex
in interfaceListIterator<E>
-
previous
public E previous()
Returns the previous element in the list and moves the cursor position backwards.- Specified by:
previous
in interfaceListIterator<E>
-
set
public void set(E e)
Replaces the last element returned by next() or previous() with the specified element .- Specified by:
set
in interfaceListIterator<E>
-
add
public void add(E e)
Inserts the specified element in the list- Specified by:
add
in interfaceListIterator<E>
-
-