org.apache.commons.collections.iterators

Class FilterListIterator

public class FilterListIterator extends Object implements ListIterator

Decorates another ListIterator using a predicate to filter elements.

This iterator decorates the underlying iterator, only allowing through those elements that match the specified Predicate.

Since: Commons Collections 2.0

Version: $Revision: 348018 $ $Date: 2005-11-21 23:34:37 +0000 (Mon, 21 Nov 2005) $

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
voidadd(Object o)
Not supported.
ListIteratorgetListIterator()
Gets the iterator this iterator is using.
PredicategetPredicate()
Gets the predicate this iterator is using.
booleanhasNext()
booleanhasPrevious()
Objectnext()
intnextIndex()
Objectprevious()
intpreviousIndex()
voidremove()
Not supported.
voidset(Object o)
Not supported.
voidsetListIterator(ListIterator iterator)
Sets the iterator for this iterator to use.
voidsetPredicate(Predicate predicate)
Sets the predicate this the iterator to use.

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.

getListIterator

public ListIterator getListIterator()
Gets the iterator this iterator is using.

Returns: the iterator.

getPredicate

public Predicate getPredicate()
Gets the predicate this iterator is using.

Returns: the predicate.

hasNext

public boolean hasNext()

hasPrevious

public boolean hasPrevious()

next

public Object next()

nextIndex

public int nextIndex()

previous

public Object previous()

previousIndex

public int previousIndex()

remove

public void remove()
Not supported.

set

public void set(Object o)
Not supported.

setListIterator

public void setListIterator(ListIterator iterator)
Sets the iterator for this iterator to use. If iteration has started, this effectively resets the iterator.

Parameters: iterator the iterator to use

setPredicate

public void setPredicate(Predicate predicate)
Sets the predicate this the iterator to use.

Parameters: predicate the transformer to use

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