org.apache.commons.collections.iterators
Class FilterListIterator

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

public class FilterListIterator
extends ProxyListIterator

A proxy ListIterator which takes a Predicate instance to filter out objects from an underlying ListIterator instance. Only objects for which the specified Predicate evaluates to true are returned by the iterator.

Since:
2.0
Version:
$Revision: 1.1 $ $Date: 2002/08/15 23:13:51 $
Author:
Rodney Waldhoff

Constructor Summary
FilterListIterator()
          Constructs a new FilterListIterator that will not function until setListIterator and setPredicate are invoked.
FilterListIterator(ListIterator iterator)
          Constructs a new FilterListIterator that will not function until setPredicate is invoked.
FilterListIterator(ListIterator iterator, Predicate predicate)
          Constructs a new FilterListIterator.
FilterListIterator(Predicate predicate)
          Constructs a new FilterListIterator that will not function until setListIterator is invoked.
 
Method Summary
 void add(Object o)
          Not supported.
 Predicate getPredicate()
          Getter for the predicate property.
 boolean hasNext()
          Invokes the underlying ListIterator.hasNext() method.
 boolean hasPrevious()
          Invokes the underlying ListIterator.hasPrevious() method.
 Object next()
          Invokes the underlying ListIterator.next() method.
 int nextIndex()
          Invokes the underlying ListIterator.nextIndex() method.
 Object previous()
          Invokes the underlying ListIterator.previous() method.
 int previousIndex()
          Invokes the underlying ListIterator.previousIndex() method.
 void remove()
          Not supported.
 void set(Object o)
          Not supported.
 void setPredicate(Predicate predicate)
          Setter for the predicate property.
 
Methods inherited from class org.apache.commons.collections.iterators.ProxyListIterator
getListIterator, setListIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterListIterator

public FilterListIterator()
Constructs a new FilterListIterator that will not function until setListIterator and setPredicate are invoked.

FilterListIterator

public FilterListIterator(ListIterator iterator)
Constructs a new FilterListIterator that will not function until setPredicate is invoked.
Parameters:
iterator - the iterator to use

FilterListIterator

public FilterListIterator(ListIterator iterator,
                          Predicate predicate)
Constructs a new FilterListIterator.
Parameters:
iterator - the iterator to use
predicate - the predicate to use

FilterListIterator

public FilterListIterator(Predicate predicate)
Constructs a new FilterListIterator that will not function until setListIterator is invoked.
Parameters:
predicate - the predicate to use.
Method Detail

add

public void add(Object o)
Not supported.
Overrides:
add in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

hasNext

public boolean hasNext()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.hasNext() method.
Overrides:
hasNext in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

hasPrevious

public boolean hasPrevious()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.hasPrevious() method.
Overrides:
hasPrevious in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

next

public Object next()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.next() method.
Overrides:
next in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

nextIndex

public int nextIndex()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.nextIndex() method.
Overrides:
nextIndex in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

previous

public Object previous()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.previous() method.
Overrides:
previous in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

previousIndex

public int previousIndex()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.previousIndex() method.
Overrides:
previousIndex in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

remove

public void remove()
Not supported.
Overrides:
remove in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

set

public void set(Object o)
Not supported.
Overrides:
set in class ProxyListIterator
Tags copied from class: ProxyListIterator
Throws:
NullPointerException - if the underyling iterator is null

getPredicate

public Predicate getPredicate()
Getter for the predicate property.
Returns:
value of the predicate property.

setPredicate

public void setPredicate(Predicate predicate)
Setter for the predicate property.
Parameters:
predicate - new value for the predicate property.


Copyright © 2001-2002 Apache Software Foundation. Documenation generated October 21 2002.