net.cscott.jutil

Class UnmodifiableIterator<E>

public abstract class UnmodifiableIterator<E> extends Object implements 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 java.util.Collections and etc.

Version: $Id: UnmodifiableIterator.java,v 1.1 2003/03/20 01:58:20 cananian Exp $

Author: C. Scott Ananian

Method Summary
abstract booleanhasNext()
Returns true if the iteration has more elements.
abstract Enext()
Returns the next element in the iteration.
voidremove()
Always throws an UnsupportedOperationException.

Method Detail

hasNext

public abstract boolean hasNext()
Returns true if the iteration has more elements.

Returns: true if the iterator has more elements.

next

public abstract E next()
Returns the next element in the iteration.

Throws: java.util.NoSuchElementException iteration has no more elements.

remove

public final void remove()
Always throws an UnsupportedOperationException.

Throws: UnsupportedOperationException always.

Copyright © 2003 C. Scott Ananian