org.apache.commons.collections.iterators

Class FilterListIterator

Implemented Interfaces:
ListIterator
Known Direct 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.
Version:
$Revision: 1.1.2.1 $ $Date: 2004/05/22 12:14:04 $
Author:
Rodney Waldhoff
Since:
2.0

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()
boolean
hasPrevious()
Object
next()
int
nextIndex()
Object
previous()
int
previousIndex()
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

add, getListIterator, hasNext, hasPrevious, next, nextIndex, previous, previousIndex, remove, set, setListIterator

Constructor Details

FilterListIterator

public FilterListIterator()

FilterListIterator

public FilterListIterator(ListIterator iterator)
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 Details

add

public void add(Object o)
Not supported.
Overrides:
add in interface ProxyListIterator

getPredicate

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

hasNext

public boolean hasNext()
Overrides:
hasNext in interface ProxyListIterator

hasPrevious

public boolean hasPrevious()
Overrides:
hasPrevious in interface ProxyListIterator

next

public Object next()
Overrides:
next in interface ProxyListIterator

nextIndex

public int nextIndex()
Overrides:
nextIndex in interface ProxyListIterator

previous

public Object previous()
Overrides:
previous in interface ProxyListIterator

previousIndex

public int previousIndex()
Overrides:
previousIndex in interface ProxyListIterator

remove

public void remove()
Not supported.
Overrides:
remove in interface ProxyListIterator

set

public void set(Object o)
Not supported.
Overrides:
set in interface ProxyListIterator

setPredicate

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

Copyright © 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}.