public static final class Filter.Util extends Object
import static de.espirit.common.util.Filter.Util.and; import static de.espirit.common.util.Filter.Util.doFilter; import static de.espirit.common.util.Filter.Util.not; import static de.espirit.common.util.Filter.Util.or; ... ListallResults = ...; Filter<Integer> biggerThanZero = ...; Filter<Integer> isMultipleOf_13 = ...; Filter<Integer> isOdd = ...; Filter<Integer> combinedFilter = and(de.espirit.common.util.Filter<T>...)
(biggerThanZero,not(de.espirit.common.util.Filter<T>)
(or(de.espirit.common.util.Filter<T>...)
(isMultipleOf_13, isOdd))); ListfilteredResult = doFilter(java.util.Collection<T>, de.espirit.common.util.Filter<T>, C)
(allResults, combinedFilter, new ArrayList<Integer>());
Modifier and Type | Method and Description |
---|---|
static <T> Filter<T> |
acceptAll()
A primitive filter accepting any element.
|
static <T> Filter<T> |
acceptNothing()
A primitive filter accepting no element.
|
static <T> Filter<T> |
and(Collection<Filter<T>> f)
Factory to create a combinatorial conjunction-filter on a given collection of filters.
|
static <T> Filter<T> |
and(Filter<T>... f)
Factory to create a combinatorial conjunction-filter on the given arguments.
|
static <T,C extends Collection<T>> |
doFilter(Collection<T> source,
Filter<T> filter,
C target)
Copies all matching entries of collection source to collection target.
|
static <T> Filter<T> |
equal(T value)
Factory creating an equality filter with the given value as comparison operand.
|
static <T> Filter<T> |
implies(Filter<T> condition,
Filter<T> implication)
Factory to create a logical consequence based filter on a given condition and its implication.
|
static <T> Filter<T> |
not(Filter<T> f)
Factory to create a negation of the given filter.
|
static <T> Filter<T> |
notNull()
A primitive filter accepting all non-null elements.
|
static <T> Filter<T> |
or(Collection<Filter<T>> f)
Factory to create a combinatorial disjunction-filter on a given collection of filters.
|
static <T> Filter<T> |
or(Filter<T>... f)
Factory to create a combinatorial disjunction-filter on the given arguments.
|
@NotNull public static <T> Filter<T> and(Filter<T>... f)
f
- The filters to be combined.@NotNull public static <T> Filter<T> and(@NotNull Collection<Filter<T>> f)
f
- The filters to be combined.@NotNull public static <T> Filter<T> or(Filter<T>... f)
f
- The filtersr to be combined.@NotNull public static <T> Filter<T> or(@NotNull Collection<Filter<T>> f)
f
- The filters to be combined.@NotNull public static <T> Filter<T> not(@NotNull Filter<T> f)
f
- The filter to be negated.@NotNull public static <T> Filter<T> implies(@NotNull Filter<T> condition, @NotNull Filter<T> implication)
condition
- The condition that may be accepted or not.implication
- The implication that must be accepted.true
, if the condition does not hold or the implication accepts the element.@NotNull public static <T,C extends Collection<T>> C doFilter(@NotNull Collection<T> source, @NotNull Filter<T> filter, @NotNull C target)
source
- source collectionfilter
- filter - only matching entries will be copiedtarget
- target collection@NotNull public static <T> Filter<T> equal(T value)
value
- The comparison operand.@NotNull public static <T> Filter<T> acceptAll()
@NotNull public static <T> Filter<T> acceptNothing()
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210