public class FilteringIterator<E> extends Object implements ListIterator<E>
remove() is not supported! Please
see getFilteringIterable(Iterable, IPredicate) to wrap your original collection into a filtered collection.| Constructor and Description |
|---|
FilteringIterator(Iterable<E> parent,
IPredicate<E> predicate)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(E e) |
static <I extends Iterable<T>,T> |
getFilteringIterable(I iterable,
IPredicate<T> predicate)
creates a proxy using the given iterable instance. if an iterator is requested, the orginal iterator will be
wrapped into the
FilteringIterator. |
static <I extends Map<S,T>,S,T> |
getFilteringMap(I map,
IPredicate<T> predicate)
creates a proxy using the given map instance. if a key iterator is requested, the orginal iterator will be
wrapped into the
FilteringIterator. |
static Iterable |
getIterable(Proxy proxy)
ONLY FOR FRAMEWORK-INTERNAL USE!
|
boolean |
hasNext() |
boolean |
hasPrevious() |
E |
next() |
int |
nextIndex() |
E |
previous() |
int |
previousIndex() |
void |
remove() |
void |
set(E e) |
protected int |
size()
on first call, the size has to be evaluated
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic FilteringIterator(Iterable<E> parent, IPredicate<E> predicate)
parent - predicate - public boolean hasNext()
public E next()
public void remove()
public boolean hasPrevious()
hasPrevious in interface ListIterator<E>public E previous()
previous in interface ListIterator<E>public int nextIndex()
nextIndex in interface ListIterator<E>public int previousIndex()
previousIndex in interface ListIterator<E>public void set(E e)
set in interface ListIterator<E>public void add(E e)
add in interface ListIterator<E>protected int size()
public static Iterable getIterable(Proxy proxy)
FilteringIterator, the internal used collection will
be returned.proxy - proxy having an invocation handler of type FilteringIterator.public static <I extends Iterable<T>,T> I getFilteringIterable(I iterable, IPredicate<T> predicate)
FilteringIterator.
As the original instance (the collection) will be preserved, all other methods like size(), contains() etc. will
work on the un-filtered content!I - iterable type - mostly at least a collectionT - member type of the iterableiterable - iterable instancepredicate - item filter/selectorpublic static <I extends Map<S,T>,S,T> I getFilteringMap(I map, IPredicate<T> predicate)
FilteringIterator.
As the original instance will be preserved, all other methods like size(), contains() etc. will work on the
un-filtered content!I - iterable type - mostly at least a collectionT - member type of the iterablemap - iterable instancepredicate - item filter/selectorCopyright © 2012–2018. All rights reserved.