@GwtCompatible abstract class AbstractIndexedListIterator<E> extends UnmodifiableListIterator<E>
ListIterator
interface across a
fixed number of elements that may be retrieved by position. It does not support UnmodifiableIterator.remove()
,
UnmodifiableListIterator.set(E)
, or UnmodifiableListIterator.add(E)
.Modifier | Constructor and Description |
---|---|
protected |
AbstractIndexedListIterator(int size)
Constructs an iterator across a sequence of the given size whose initial position is 0.
|
protected |
AbstractIndexedListIterator(int size,
int position)
Constructs an iterator across a sequence of the given size with the given initial position.
|
Modifier and Type | Method and Description |
---|---|
protected abstract E |
get(int index)
Returns the element with the specified index.
|
boolean |
hasNext() |
boolean |
hasPrevious() |
E |
next() |
int |
nextIndex() |
E |
previous() |
int |
previousIndex() |
add, set
remove
protected AbstractIndexedListIterator(int size)
next()
will return the first element (or throw NoSuchElementException
if size
is zero).java.lang.IllegalArgumentException
- if size
is negativeprotected AbstractIndexedListIterator(int size, int position)
nextIndex()
will return position
, and the first
call to next()
will return the element at that index, if available. Calls to previous()
can retrieve the preceding position
elements.java.lang.IndexOutOfBoundsException
- if position
is negative or is greater than size
java.lang.IllegalArgumentException
- if size
is negativeprotected abstract E get(int index)
next()
.public final boolean hasNext()
public final E next()
public final int nextIndex()
public final boolean hasPrevious()
public final E previous()
public final int previousIndex()