harpoon.Util
Class UnmodifiableIterator

java.lang.Object
  |
  +--harpoon.Util.UnmodifiableIterator
All Implemented Interfaces:
Iterator
Direct Known Subclasses:
ArrayIterator, EdgesIterator, EnumerationIterator, FilterIterator, ReverseIterator

public abstract class UnmodifiableIterator
extends Object
implements Iterator

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.2 2002/02/25 21:08:56 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
UnmodifiableIterator()
           
 
Method Summary
abstract  boolean hasNext()
          Returns true if the iteration has more elements.
abstract  Object next()
          Returns the next element in the iteration.
 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

UnmodifiableIterator

public UnmodifiableIterator()
Method Detail

hasNext

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

Specified by:
hasNext in interface Iterator
Returns:
true if the iterator has more elements.

next

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

Specified by:
next in interface Iterator
Throws:
NoSuchElementException - iteration has no more elements.

remove

public final void remove()
Always throws an UnsupportedOperationException.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - always.