public class FilterUtils extends Object
Predicate
.Modifier and Type | Method and Description |
---|---|
static <T> Collection<T> |
filter(Collection<? extends T> in,
Collection<T> out,
Predicate<T> filter)
Filter a collection, storing the accepted items in the given output
collection.
|
static <T,Q extends T> |
filter(Collection<Q> in,
Predicate<T> filter)
Filter a collection, returning the accepted items in an
ArrayList
. |
static <T> Iterator<T> |
filteredIterator(Iterable<? extends T> iterable,
Predicate<T> filter)
Create an iterator that filters items from the given
Iterable . |
static <T> Iterator<T> |
filteredIterator(Iterator<? extends T> iterator,
Predicate<T> filter)
Create an iterator that filters items from the given
Iterator . |
static <T> Iterator<T> |
filteredIterator(T[] array,
Predicate<T> filter)
Create an iterator that filters items from the given array.
|
public static <T,Q extends T> ArrayList<Q> filter(Collection<Q> in, Predicate<T> filter)
ArrayList
.T
- type of object being filteredQ
- type of object accepted by the filterin
- input collectionfilter
- the filterPredicate.test(Object)
public static <T> Collection<T> filter(Collection<? extends T> in, Collection<T> out, Predicate<T> filter)
T
- type of object being filteredin
- input collectionout
- output collectionfilter
- the filterPredicate.test(Object)
public static <T> Iterator<T> filteredIterator(Iterable<? extends T> iterable, Predicate<T> filter)
Iterable
.T
- type of object being filterediterable
- Iterable
to filterfilter
- the filterPredicate.test(Object)
public static <T> Iterator<T> filteredIterator(Iterator<? extends T> iterator, Predicate<T> filter)
Iterator
.T
- type of object being filterediterator
- Iterator
to filterfilter
- the filterPredicate.test(Object)
public static <T> Iterator<T> filteredIterator(T[] array, Predicate<T> filter)
T
- type of object being filteredarray
- to filterfilter
- the filterPredicate.test(Object)