⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.iterators

Class ProxyIterator

java.lang.Object
|
+--org.apache.commons.collections.iterators.ProxyIterator

All Implemented Interfaces:
Iterator


public class ProxyIterator
extends java.lang.Object
implements Iterator

A Proxy Iterator Iterator which delegates its methods to a proxy instance.
Since:
Commons Collections 1.0
Author:
James Strachan

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()

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