org.apache.commons.collections.iterators

Class ProxyIterator

Implemented Interfaces:
Iterator

public class ProxyIterator
extends java.lang.Object
implements Iterator

A Proxy Iterator which delegates its methods to a proxy instance.
Version:
$Revision: 1.10 $ $Date: 2004/02/18 00:59:50 $
Author:
James Strachan
Since:
Commons Collections 1.0

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.

Constructor Details

ProxyIterator

public ProxyIterator()

ProxyIterator

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

Method Details

getIterator

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

hasNext

public boolean hasNext()
Returns true if the underlying iterator has more elements.
Returns:
true if the underlying iterator has more elements

next

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

remove

public void remove()
Removes the last returned element from the collection that spawned the underlying iterator.

setIterator

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

Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.