Package net.cscott.jutil
Class UnmodifiableIterator<E>
java.lang.Object
net.cscott.jutil.UnmodifiableIterator<E>
- All Implemented Interfaces:
Iterator<E>
@Deprecated(since="2.0")
public abstract class UnmodifiableIterator<E>
extends Object
implements Iterator<E>
Deprecated.
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.- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanhasNext()Deprecated.Returnstrueif the iteration has more elements.abstract Enext()Deprecated.Returns the next element in the iteration.static <E> UnmodifiableIterator<E> Deprecated.Create anUnmodifiableIteratorfrom the given (potentailly modifiable)Iterator.final voidremove()Deprecated.Always throws anUnsupportedOperationException.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
UnmodifiableIterator
public UnmodifiableIterator()Deprecated.
-
-
Method Details
-
proxy
Deprecated.Create anUnmodifiableIteratorfrom the given (potentailly modifiable)Iterator.- Since:
- 1.3
-
hasNext
public abstract boolean hasNext()Deprecated.Returnstrueif the iteration has more elements. -
next
Deprecated.Returns the next element in the iteration.- Specified by:
nextin interfaceIterator<E>- Throws:
NoSuchElementException- iteration has no more elements.
-
remove
public final void remove()Deprecated.Always throws anUnsupportedOperationException.- Specified by:
removein interfaceIterator<E>- Throws:
UnsupportedOperationException- always.
-
Iteratorinstead: its defaultremove()method throwsUnsupportedOperationException. In place ofproxy(Iterator), useDefault.unmodifiableIterator(java.util.Iterator<? extends E>).