org.apache.commons.collections.iterators
Class ProxyIterator

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

public class ProxyIterator
extends java.lang.Object
implements java.util.Iterator

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

Since:
1.0
Version:
$Revision: 1.1.2.1 $ $Date: 2004/05/22 12:14:04 $
Author:
James Strachan
See Also:
ProxyListIterator

Constructor Summary
ProxyIterator()
          Constructs a new ProxyIterator that will not function until setIterator(Iterator) is called.
ProxyIterator(java.util.Iterator iterator)
          Constructs a new ProxyIterator that will use the given iterator.
 
Method Summary
 java.util.Iterator getIterator()
          Getter for property iterator.
 boolean hasNext()
          Returns true if the underlying iterator has more elements.
 java.lang.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(java.util.Iterator iterator)
          Setter for property iterator.
 
Methods inherited from class java.lang.Object
equals, 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(java.util.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 java.util.Iterator
Returns:
true if the underlying iterator has more elements

next

public java.lang.Object next()
Returns the next element from the underlying iterator.

Specified by:
next in interface java.util.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 java.util.Iterator

getIterator

public java.util.Iterator getIterator()
Getter for property iterator.

Returns:
Value of property iterator.

setIterator

public void setIterator(java.util.Iterator iterator)
Setter for property iterator.

Parameters:
iterator - New value of property iterator.


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.