Class FilterListIterator
java.lang.Object
org.apache.commons.collections.iterators.FilterListIterator
- All Implemented Interfaces:
Iterator
,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: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- Author:
- Rodney Waldhoff
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newFilterListIterator
that will not function untilsetListIterator
andsetPredicate
are invoked.FilterListIterator
(ListIterator iterator) Constructs a newFilterListIterator
that will not function untilsetPredicate
is invoked.FilterListIterator
(ListIterator iterator, Predicate predicate) Constructs a newFilterListIterator
.FilterListIterator
(Predicate predicate) Constructs a newFilterListIterator
that will not function untilsetListIterator
is invoked. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Not supported.Gets the iterator this iterator is using.Gets the predicate this iterator is using.boolean
hasNext()
boolean
next()
int
previous()
int
void
remove()
Not supported.void
Not supported.void
setListIterator
(ListIterator iterator) Sets the iterator for this iterator to use.void
setPredicate
(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 Details
-
FilterListIterator
public FilterListIterator()Constructs a newFilterListIterator
that will not function untilsetListIterator
andsetPredicate
are invoked. -
FilterListIterator
Constructs a newFilterListIterator
that will not function untilsetPredicate
is invoked.- Parameters:
iterator
- the iterator to use
-
FilterListIterator
Constructs a newFilterListIterator
.- Parameters:
iterator
- the iterator to usepredicate
- the predicate to use
-
FilterListIterator
Constructs a newFilterListIterator
that will not function untilsetListIterator
is invoked.- Parameters:
predicate
- the predicate to use.
-
-
Method Details
-
add
Not supported.- Specified by:
add
in interfaceListIterator
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator
- Specified by:
hasNext
in interfaceListIterator
-
hasPrevious
public boolean hasPrevious()- Specified by:
hasPrevious
in interfaceListIterator
-
next
- Specified by:
next
in interfaceIterator
- Specified by:
next
in interfaceListIterator
-
nextIndex
public int nextIndex()- Specified by:
nextIndex
in interfaceListIterator
-
previous
- Specified by:
previous
in interfaceListIterator
-
previousIndex
public int previousIndex()- Specified by:
previousIndex
in interfaceListIterator
-
remove
public void remove()Not supported.- Specified by:
remove
in interfaceIterator
- Specified by:
remove
in interfaceListIterator
-
set
Not supported.- Specified by:
set
in interfaceListIterator
-
getListIterator
Gets the iterator this iterator is using.- Returns:
- the iterator.
-
setListIterator
Sets the iterator for this iterator to use. If iteration has started, this effectively resets the iterator.- Parameters:
iterator
- the iterator to use
-
getPredicate
Gets the predicate this iterator is using.- Returns:
- the predicate.
-
setPredicate
Sets the predicate this the iterator to use.- Parameters:
predicate
- the transformer to use
-