org.apache.commons.collections.iterators
Class ProxyIterator

java.lang.Object
  |
  +--org.apache.commons.collections.iterators.ProxyIterator
Direct Known Subclasses:
FilterIterator, TransformIterator

public class ProxyIterator
extends Object
implements Iterator

A Proxy Iterator which delegates its methods to a proxy instance.

Since:
1.0
Version:
$Revision: 1.1 $ $Date: 2002/08/15 23:13:51 $
Author:
James Strachan
See Also:
ProxyListIterator

Constructor Summary
ProxyIterator()
          Constructs a new ProxyIterator that will not function until setIterator(Iterator) is called.
ProxyIterator(Iterator iterator)
          Constructs a new ProxyIterator that will use the given iterator.
 
Method Summary
 Iterator getIterator()
          Getter for property iterator.
 boolean hasNext()
          Returns true if the underlying iterator has more elements.
 Object next()
          Returns the next element from the underlying iterator.
 void remove()
          Removes the last returned element from the collection that spawned the underlying iterator.
 void setIterator(Iterator iterator)
          Setter for property iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyIterator

public ProxyIterator()
Constructs a new ProxyIterator that will not function until setIterator(Iterator) is called.

ProxyIterator

public ProxyIterator(Iterator iterator)
Constructs a new ProxyIterator that will use the given iterator.
Parameters:
iterator - the underyling iterator
Method Detail

hasNext

public boolean hasNext()
Returns true if the underlying iterator has more elements.
Specified by:
hasNext in interface Iterator
Returns:
true if the underlying iterator has more elements

next

public Object next()
Returns the next element from the underlying iterator.
Specified by:
next in interface Iterator
Returns:
the next element from the underlying iterator
Throws:
NoSuchElementException - if the underlying iterator raises it because it has no more elements

remove

public void remove()
Removes the last returned element from the collection that spawned the underlying iterator.
Specified by:
remove in interface Iterator

getIterator

public Iterator getIterator()
Getter for property iterator.
Returns:
Value of property iterator.

setIterator

public void setIterator(Iterator iterator)
Setter for property iterator.
Parameters:
iterator - New value of property iterator.


Copyright © 2001-2002 Apache Software Foundation. Documenation generated October 21 2002.