public abstract class UnmodifiableListIterator<E>
extends java.lang.Object
implements java.util.ListIterator<E>
UnmodifiableListIterator is an abstract superclass to
save you the trouble of implementing the remove(),
add(Object) and set(Object) methods over and over again
for those list iterators which don't implement them. The name's a
bit clunky, but fits with the JDK naming in
Collections and such.| Constructor and Description |
|---|
UnmodifiableListIterator() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(E o)
Always throws an
UnsupportedOperationException. |
abstract boolean |
hasNext()
Returns
true if the list iterator has more elements
in the forward direction. |
abstract boolean |
hasPrevious()
Returns
true if the list iterator has more elements
in the reverse direction. |
abstract E |
next()
Returns the next element in the list.
|
abstract int |
nextIndex()
Returns the index of the element that would be returned by a
subsequent call to
next(). |
abstract E |
previous()
Returns the previous element in the list.
|
int |
previousIndex()
Returns the index of the element that would be returned by a
subsequent call to
previous(). |
void |
remove()
Always throws an
UnsupportedOperationException. |
void |
set(E o)
Always throws an
UnsupportedOperationException. |
public abstract boolean hasNext()
true if the list iterator has more elements
in the forward direction.public abstract E next()
previous() to go back and forth.
(Note that alternating calls to next() and
previous() will return the same element
repeatedly.)public abstract boolean hasPrevious()
true if the list iterator has more elements
in the reverse direction.hasPrevious in interface java.util.ListIterator<E>public abstract E previous()
next() to go back and forth.
(Note that alternating calls to next() and
previous() will return the same element repeatedly.)previous in interface java.util.ListIterator<E>java.util.NoSuchElementException - if the iteration has no previous
element.public abstract int nextIndex()
next(). (Returns list size if the
list iterator is at the end of the list.)nextIndex in interface java.util.ListIterator<E>public int previousIndex()
previous(). (Returns -1 if the
list iterator is at the beginning of the list.)previousIndex in interface java.util.ListIterator<E>public final void remove()
UnsupportedOperationException.public final void set(E o)
UnsupportedOperationException.set in interface java.util.ListIterator<E>java.lang.UnsupportedOperationException - always.Copyright (c) 2006 C. Scott Ananian