|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectargutia.tools.UnmodifiableIterator<E>
argutia.tools.UnmodifiableListIterator<E>
E
- the object type being iterated over.public class UnmodifiableListIterator<E>
Decorates a list iterator such that iterator cannot be modified.
Field Summary |
---|
Fields inherited from class argutia.tools.UnmodifiableIterator |
---|
iterator |
Constructor Summary | |
---|---|
UnmodifiableListIterator(ListIterator<E> iterator)
Decorates the specified list iterator such that iterator cannot be modified. |
Method Summary | |
---|---|
void |
add(E element)
Unsupported operation. |
boolean |
hasPrevious()
Returns true if this list iterator has more elements
when traversing the list in the reverse direction. |
int |
nextIndex()
Returns the index of the element that would be returned by a subsequent call to UnmodifiableIterator.next() . |
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 |
set(E element)
Unsupported operation. |
Methods inherited from class argutia.tools.UnmodifiableIterator |
---|
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.ListIterator |
---|
hasNext, next, remove |
Constructor Detail |
---|
public UnmodifiableListIterator(ListIterator<E> iterator)
iterator
- list iterator being wrapped.Method Detail |
---|
public void add(E element) throws UnsupportedOperationException
UnsupportedOperationException
.
add
in interface ListIterator<E>
element
- the element to insert.
UnsupportedOperationException
- always.
public boolean hasPrevious()
true
if this list iterator has more elements
when traversing the list in the reverse direction.
In other words, returns true
if previous()
would return an element rather than throwing an exception.
hasPrevious
in interface ListIterator<E>
true
if the list iterator has more elements
when traversing the list in the reverse direction.
public int nextIndex()
UnmodifiableIterator.next()
.
Returns list size if the list iterator is at the end of the list.
nextIndex
in interface ListIterator<E>
UnmodifiableIterator.next()
,
or list size if list iterator is at end of list.public E previous() throws NoSuchElementException
UnmodifiableIterator.next()
to go back and forth.
Note that alternating calls to UnmodifiableIterator.next()
and previous()
will return the same element repeatedly.
previous
in interface ListIterator<E>
NoSuchElementException
- if the iteration has no previous element.
public int previousIndex()
previous()
.
Returns -1
if the list iterator is at the beginning of the list.
previousIndex
in interface ListIterator<E>
previous()
,
or -1
if list iterator is at beginning of list.public void set(E element) throws UnsupportedOperationException
UnsupportedOperationException
.
set
in interface ListIterator<E>
element
- the element with which to replace the last element
returned by UnmodifiableIterator.next()
or previous()
.
UnsupportedOperationException
- always.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |