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 $ $Date: 2002/08/15 23:13:51 $
- Author:
- See Also:
ProxyListIterator
| Field Summary |
private java.util.Iterator |
iterator
Holds value of property iterator. |
| 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iterator
private java.util.Iterator iterator
-
Holds value of property iterator.
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
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.
Please see keelframework.org for information about new Keel releases.