public abstract class UnmodifiableIterator<E>
extends java.lang.Object
implements java.util.Iterator<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 and Description |
|---|
UnmodifiableIterator() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
hasNext()
Returns
true if the iteration has more elements. |
abstract E |
next()
Returns the next element in the iteration.
|
static <E> UnmodifiableIterator<E> |
proxy(java.util.Iterator<E> it)
Create an
UnmodifiableIterator from the given (potentailly
modifiable) Iterator. |
void |
remove()
Always throws an
UnsupportedOperationException. |
public static <E> UnmodifiableIterator<E> proxy(java.util.Iterator<E> it)
UnmodifiableIterator from the given (potentailly
modifiable) Iterator.public abstract boolean hasNext()
true if the iteration has more elements.hasNext in interface java.util.Iterator<E>true if the iterator has more elements.public abstract E next()
next in interface java.util.Iterator<E>java.util.NoSuchElementException - iteration has no more elements.public final void remove()
UnsupportedOperationException.remove in interface java.util.Iterator<E>java.lang.UnsupportedOperationException - always.Copyright (c) 2006 C. Scott Ananian