|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.jutil.UnmodifiableIterator<E>
public abstract class UnmodifiableIterator<E>
UnmodifiableIterator
is an abstract superclass to save
you the trouble of implementing the remove()
method
over and over again for those iterators which don't implement it.
The name's a bit clunky, but fits with the JDK naming in
Collections
and etc.
Constructor Summary | |
---|---|
UnmodifiableIterator()
|
Method Summary | ||
---|---|---|
abstract boolean |
hasNext()
Returns true if the iteration has more elements. |
|
abstract E |
next()
Returns the next element in the iteration. |
|
static
|
proxy(Iterator<E> it)
Create an UnmodifiableIterator from the given (potentailly
modifiable) Iterator . |
|
void |
remove()
Always throws an UnsupportedOperationException . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UnmodifiableIterator()
Method Detail |
---|
public static <E> UnmodifiableIterator<E> proxy(Iterator<E> it)
UnmodifiableIterator
from the given (potentailly
modifiable) Iterator
.
public abstract boolean hasNext()
true
if the iteration has more elements.
hasNext
in interface Iterator<E>
true
if the iterator has more elements.public abstract E next()
next
in interface Iterator<E>
NoSuchElementException
- iteration has no more elements.public final void remove()
UnsupportedOperationException
.
remove
in interface Iterator<E>
UnsupportedOperationException
- always.
|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |