org.apache.commons.collections.iterators

Class ProxyIterator

public class ProxyIterator extends Object implements Iterator

Deprecated: Use AbstractIteratorDecorator. Will be removed in v4.0

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

Since: Commons Collections 1.0

Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $

Author: James Strachan

Constructor Summary
ProxyIterator()
Constructs a new ProxyIterator that will not function until setIterator is called.
ProxyIterator(Iterator iterator)
Constructs a new ProxyIterator that will use the given iterator.
Method Summary
IteratorgetIterator()
Getter for property iterator.
booleanhasNext()
Returns true if the underlying iterator has more elements.
Objectnext()
Returns the next element from the underlying iterator.
voidremove()
Removes the last returned element from the collection that spawned the underlying iterator.
voidsetIterator(Iterator iterator)
Setter for property iterator.

Constructor Detail

ProxyIterator

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

ProxyIterator

public ProxyIterator(Iterator iterator)
Constructs a new ProxyIterator that will use the given iterator.

Parameters: iterator the underlying iterator

Method Detail

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

Throws: java.util.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.

setIterator

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

Parameters: iterator New value of property iterator.

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