public class CachingListIterator<T>
extends java.lang.Object
implements java.util.ListIterator<T>
ListIterator
based on a regular Iterator
which supports both forwards and backwards traversal
by caching the previous values. ListIterator.remove()
is only supported if the Iterator
supports it,
and not after moving backwards in the iterator.Constructor and Description |
---|
CachingListIterator(java.util.Iterator<T> iterator) |
Modifier and Type | Method and Description |
---|---|
void |
add(T t) |
boolean |
hasNext() |
boolean |
hasPrevious() |
T |
next() |
int |
nextIndex() |
T |
previous() |
int |
previousIndex() |
void |
remove() |
void |
set(T t) |
public CachingListIterator(java.util.Iterator<T> iterator)
public boolean hasNext()
public T next()
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<T>
public int nextIndex()
nextIndex
in interface java.util.ListIterator<T>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<T>
public void remove()