Class FilterListIterator
- java.lang.Object
-
- org.apache.commons.collections.iterators.FilterListIterator
-
- All Implemented Interfaces:
java.util.Iterator,java.util.ListIterator
public class FilterListIterator extends java.lang.Object implements java.util.ListIteratorDecorates 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
-
-
Constructor Summary
Constructors Constructor Description FilterListIterator()Constructs a newFilterListIteratorthat will not function untilsetListIteratorandsetPredicateare invoked.FilterListIterator(java.util.ListIterator iterator)Constructs a newFilterListIteratorthat will not function untilsetPredicateis invoked.FilterListIterator(java.util.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(java.lang.Object o)Not supported.java.util.ListIteratorgetListIterator()Gets the iterator this iterator is using.PredicategetPredicate()Gets the predicate this iterator is using.booleanhasNext()booleanhasPrevious()java.lang.Objectnext()intnextIndex()java.lang.Objectprevious()intpreviousIndex()voidremove()Not supported.voidset(java.lang.Object o)Not supported.voidsetListIterator(java.util.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 newFilterListIteratorthat will not function untilsetListIteratorandsetPredicateare invoked.
-
FilterListIterator
public FilterListIterator(java.util.ListIterator iterator)
Constructs a newFilterListIteratorthat will not function untilsetPredicateis invoked.- Parameters:
iterator- the iterator to use
-
FilterListIterator
public FilterListIterator(java.util.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(java.lang.Object o)
Not supported.- Specified by:
addin interfacejava.util.ListIterator
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator- Specified by:
hasNextin interfacejava.util.ListIterator
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPreviousin interfacejava.util.ListIterator
-
next
public java.lang.Object next()
- Specified by:
nextin interfacejava.util.Iterator- Specified by:
nextin interfacejava.util.ListIterator
-
nextIndex
public int nextIndex()
- Specified by:
nextIndexin interfacejava.util.ListIterator
-
previous
public java.lang.Object previous()
- Specified by:
previousin interfacejava.util.ListIterator
-
previousIndex
public int previousIndex()
- Specified by:
previousIndexin interfacejava.util.ListIterator
-
remove
public void remove()
Not supported.- Specified by:
removein interfacejava.util.Iterator- Specified by:
removein interfacejava.util.ListIterator
-
set
public void set(java.lang.Object o)
Not supported.- Specified by:
setin interfacejava.util.ListIterator
-
getListIterator
public java.util.ListIterator getListIterator()
Gets the iterator this iterator is using.- Returns:
- the iterator.
-
setListIterator
public void setListIterator(java.util.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
-
-