private class ScopedList.NodeList.Iter
extends java.lang.Object
implements java.util.ListIterator<E>
Modifier and Type | Field and Description |
---|---|
private ScopedList.Node<E> |
current
Node currently being iterated
|
private int |
index
Iteration cursor position
|
Constructor and Description |
---|
Iter(int index)
Constructor which accepts an initial cursor position.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E e)
Add a new element after the current element -- unsupported in this read-only
implementation.
|
boolean |
hasNext()
Indicate whether there is a next element to visit.
|
boolean |
hasPrevious()
Indicate whether there is a previous element to visit.
|
E |
next()
Return the element immediately after the current cursor position and move the cursor
forward one element.
|
int |
nextIndex()
Report the index of the element immediately after the cursor's current position.
|
E |
previous()
Return the element immediately before the current cursor position and move the cursor
backward one element.
|
int |
previousIndex()
Report the index of the element immediately before the cursor's current position.
|
void |
remove()
Remove the current element -- unsupported in this read-only implementation.
|
void |
set(E e)
Replace the current element -- unsupported in this read-only implementation.
|
private ScopedList.Node<E> current
private int index
Iter(int index)
index
- Zero-based cursor position. The logical cursor is positioned before the
element at this index.java.lang.IndexOutOfBoundsException
- if index < 0 || index > size()
public boolean hasNext()
public E next()
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<E>
true
if there is a previous element, else false
.public E previous()
previous
in interface java.util.ListIterator<E>
java.util.NoSuchElementException
- if there is no available element to return.public int nextIndex()
nextIndex
in interface java.util.ListIterator<E>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<E>
public void remove()
public void set(E e)
set
in interface java.util.ListIterator<E>
java.lang.UnsupportedOperationException
- always.