|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectargutia.tools.UnmodifiableIterator<E>
E
- the object type being iterated over.public class UnmodifiableIterator<E>
Decorates an iterator such that iterator cannot be modified.
Field Summary | |
---|---|
protected Iterator<E> |
iterator
Wrapped iterator. |
Constructor Summary | |
---|---|
UnmodifiableIterator(Iterator<E> iterator)
Decorates the specified iterator such that iterator cannot be modified. |
Method Summary | |
---|---|
boolean |
hasNext()
Returns true if the iteration has more elements. |
E |
next()
Returns the next element in the iteration. |
void |
remove()
Unsupported operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Iterator<E> iterator
Constructor Detail |
---|
public UnmodifiableIterator(Iterator<E> iterator)
iterator
- iterator being wrapped.Method Detail |
---|
public boolean hasNext()
true
if the iteration has more elements.
In other words, returns true
if next()
would return an element rather than throwing an exception.
hasNext
in interface Iterator<E>
true
if the iterator has more elements.public E next() throws NoSuchElementException
hasNext()
method returns false
will return each element in the underlying collection exactly once.
next
in interface Iterator<E>
NoSuchElementException
- if iteration has no more elements.public void remove() throws UnsupportedOperationException
UnsupportedOperationException
.
remove
in interface Iterator<E>
UnsupportedOperationException
- always.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |