public class FilterListIterator<E> extends Object implements ListIterator<E>
ListIterator using a predicate to filter elements.
This iterator decorates the underlying iterator, only allowing through
those elements that match the specified Predicate.
| Constructor and Description |
|---|
FilterListIterator()
Constructs a new
FilterListIterator that will not function
until setListIterator
and setPredicate are invoked. |
FilterListIterator(ListIterator<? extends E> iterator)
Constructs a new
FilterListIterator that will not
function until setPredicate is invoked. |
FilterListIterator(ListIterator<? extends E> iterator,
Predicate<? super E> predicate)
Constructs a new
FilterListIterator. |
FilterListIterator(Predicate<? super E> predicate)
Constructs a new
FilterListIterator that will not function
until setListIterator is invoked. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(E o)
Not supported.
|
ListIterator<? extends E> |
getListIterator()
Gets the iterator this iterator is using.
|
Predicate<? super E> |
getPredicate()
Gets the predicate this iterator is using.
|
boolean |
hasNext() |
boolean |
hasPrevious() |
E |
next() |
int |
nextIndex() |
E |
previous() |
int |
previousIndex() |
void |
remove()
Not supported.
|
void |
set(E o)
Not supported.
|
void |
setListIterator(ListIterator<? extends E> iterator)
Sets the iterator for this iterator to use.
|
void |
setPredicate(Predicate<? super E> predicate)
Sets the predicate this the iterator to use.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic FilterListIterator()
FilterListIterator that will not function
until setListIterator
and setPredicate are invoked.public FilterListIterator(ListIterator<? extends E> iterator)
FilterListIterator that will not
function until setPredicate is invoked.iterator - the iterator to usepublic FilterListIterator(ListIterator<? extends E> iterator, Predicate<? super E> predicate)
FilterListIterator.iterator - the iterator to usepredicate - the predicate to usepublic FilterListIterator(Predicate<? super E> predicate)
FilterListIterator that will not function
until setListIterator is invoked.predicate - the predicate to use.public void add(E o)
add in interface ListIterator<E>o - the element to insertpublic boolean hasNext()
public boolean hasPrevious()
hasPrevious in interface ListIterator<E>public E next()
public int nextIndex()
nextIndex in interface ListIterator<E>public E previous()
previous in interface ListIterator<E>public int previousIndex()
previousIndex in interface ListIterator<E>public void remove()
public void set(E o)
set in interface ListIterator<E>o - the element with which to replace the last element returned by
next or previouspublic ListIterator<? extends E> getListIterator()
public void setListIterator(ListIterator<? extends E> iterator)
iterator - the iterator to usepublic Predicate<? super E> getPredicate()
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.