org.apache.commons.collections.iterators
Class FilterListIterator

java.lang.Object
  |
  +--org.apache.commons.collections.iterators.ProxyListIterator
        |
        +--org.apache.commons.collections.iterators.FilterListIterator
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator
Direct Known Subclasses:
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.2.1 $ $Date: 2004/05/22 12:14:04 $
Author:
Rodney Waldhoff

Constructor Summary
FilterListIterator()
          Constructs a new FilterListIterator that will not function until setListIterator and setPredicate are invoked.
FilterListIterator(java.util.ListIterator iterator)
          Constructs a new FilterListIterator that will not function until setPredicate is invoked.
FilterListIterator(java.util.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(java.lang.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.
 java.lang.Object next()
          Invokes the underlying ListIterator.next() method.
 int nextIndex()
          Invokes the underlying ListIterator.nextIndex() method.
 java.lang.Object previous()
          Invokes the underlying ListIterator.previous() method.
 int previousIndex()
          Invokes the underlying ListIterator.previousIndex() method.
 void remove()
          Not supported.
 void set(java.lang.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
equals, 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(java.util.ListIterator iterator)
Constructs a new FilterListIterator that will not function until setPredicate is invoked.

Parameters:
iterator - the iterator to use

FilterListIterator

public FilterListIterator(java.util.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(java.lang.Object o)
Not supported.

Specified by:
add in interface java.util.ListIterator
Overrides:
add in class ProxyListIterator

hasNext

public boolean hasNext()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.hasNext() method.

Specified by:
hasNext in interface java.util.ListIterator
Overrides:
hasNext in class ProxyListIterator

hasPrevious

public boolean hasPrevious()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.hasPrevious() method.

Specified by:
hasPrevious in interface java.util.ListIterator
Overrides:
hasPrevious in class ProxyListIterator

next

public java.lang.Object next()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.next() method.

Specified by:
next in interface java.util.ListIterator
Overrides:
next in class ProxyListIterator

nextIndex

public int nextIndex()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.nextIndex() method.

Specified by:
nextIndex in interface java.util.ListIterator
Overrides:
nextIndex in class ProxyListIterator

previous

public java.lang.Object previous()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.previous() method.

Specified by:
previous in interface java.util.ListIterator
Overrides:
previous in class ProxyListIterator

previousIndex

public int previousIndex()
Description copied from class: ProxyListIterator
Invokes the underlying ListIterator.previousIndex() method.

Specified by:
previousIndex in interface java.util.ListIterator
Overrides:
previousIndex in class ProxyListIterator

remove

public void remove()
Not supported.

Specified by:
remove in interface java.util.ListIterator
Overrides:
remove in class ProxyListIterator

set

public void set(java.lang.Object o)
Not supported.

Specified by:
set in interface java.util.ListIterator
Overrides:
set in class ProxyListIterator

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-2004 The Apache Software Foundation. All Rights Reserved.