Class FilterListIterator
- java.lang.Object
-
- org.apache.commons.collections.iterators.FilterListIterator
-
- All Implemented Interfaces:
Iterator,ListIterator
public class FilterListIterator extends Object implements ListIterator
Decorates anotherListIteratorusing 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: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- Author:
- Rodney Waldhoff
-
-
Constructor Summary
Constructors Constructor Description FilterListIterator()Constructs a newFilterListIteratorthat will not function untilsetListIteratorandsetPredicateare invoked.FilterListIterator(ListIterator iterator)Constructs a newFilterListIteratorthat will not function untilsetPredicateis invoked.FilterListIterator(ListIterator iterator, Predicate predicate)Constructs a newFilterListIterator.FilterListIterator(Predicate predicate)Constructs a newFilterListIteratorthat will not function untilsetListIteratoris invoked.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
FilterListIterator
public FilterListIterator()
Constructs a newFilterListIteratorthat will not function untilsetListIteratorandsetPredicateare invoked.
-
FilterListIterator
public FilterListIterator(ListIterator iterator)
Constructs a newFilterListIteratorthat will not function untilsetPredicateis invoked.- Parameters:
iterator- the iterator to use
-
FilterListIterator
public FilterListIterator(ListIterator iterator, Predicate predicate)
Constructs a newFilterListIterator.- Parameters:
iterator- the iterator to usepredicate- the predicate to use
-
FilterListIterator
public FilterListIterator(Predicate predicate)
Constructs a newFilterListIteratorthat will not function untilsetListIteratoris invoked.- Parameters:
predicate- the predicate to use.
-
-
Method Detail
-
add
public void add(Object o)
Not supported.- Specified by:
addin interfaceListIterator
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator- Specified by:
hasNextin interfaceListIterator
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPreviousin interfaceListIterator
-
next
public Object next()
- Specified by:
nextin interfaceIterator- Specified by:
nextin interfaceListIterator
-
nextIndex
public int nextIndex()
- Specified by:
nextIndexin interfaceListIterator
-
previous
public Object previous()
- Specified by:
previousin interfaceListIterator
-
previousIndex
public int previousIndex()
- Specified by:
previousIndexin interfaceListIterator
-
remove
public void remove()
Not supported.- Specified by:
removein interfaceIterator- Specified by:
removein interfaceListIterator
-
set
public void set(Object o)
Not supported.- Specified by:
setin interfaceListIterator
-
getListIterator
public ListIterator getListIterator()
Gets the iterator this iterator is using.- Returns:
- the iterator.
-
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
-
getPredicate
public Predicate getPredicate()
Gets the predicate this iterator is using.- Returns:
- the predicate.
-
setPredicate
public void setPredicate(Predicate predicate)
Sets the predicate this the iterator to use.- Parameters:
predicate- the transformer to use
-
-