public class Filter<T> extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MATCH_ALL
Indicates that all rules must be matched to include an object in the filtered collection.
|
static int |
MATCH_ANY
Indicates that any rule may be matched to include an object in the filtered collection.
|
Constructor and Description |
---|
Filter(Predicate<T>... rules) |
Filter(Predicate<T>[] rules,
int type)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Collection<T> |
filter(Collection<T> c)
Filter the given collection into a new collection.
|
T[] |
filter(T[] objects)
Returns a filtered subset of the specified array.
|
Predicate<T>[] |
getRules() |
void |
setRules(Predicate<T>[] rules) |
public static final int MATCH_ANY
public static final int MATCH_ALL
@SafeVarargs public Filter(Predicate<T>... rules)
rules
- one or more rules that are applied by this filterpublic final Collection<T> filter(Collection<T> c)
c
- a collection to filterpublic final T[] filter(T[] objects)
objects
- an array to filter