Package com.helger.base.functional
Class Predicates
java.lang.Object
com.helger.base.functional.Predicates
Some globally usable predicates.
- Since:
- 9.1.3
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic <DATATYPE> @NonNull Predicate<DATATYPE> all()static <T> @Nullable Predicate<T> Combine two predicates with a logical AND.static @NonNull ICharPredicatestatic @NonNull ICharPredicatestatic @NonNull ICharPredicatestatic @NonNull DoublePredicatestatic @NonNull DoublePredicatestatic @NonNull DoublePredicatestatic @NonNull DoublePredicatestatic @NonNull DoublePredicatestatic @NonNull DoublePredicatestatic @NonNull IntPredicateintIsEQ0()static @NonNull IntPredicateintIsGE0()static @NonNull IntPredicateintIsGT0()static @NonNull IntPredicateintIsLE0()static @NonNull IntPredicateintIsLT0()static @NonNull IntPredicateintIsNE0()static <DATATYPE> @NonNull Predicate<DATATYPE> isNull()static @NonNull LongPredicatestatic @NonNull LongPredicatestatic @NonNull LongPredicatestatic @NonNull LongPredicatestatic @NonNull LongPredicatestatic @NonNull LongPredicatestatic <DATATYPE> @NonNull Predicate<DATATYPE> none()static <DATATYPE> @NonNull Predicate<DATATYPE> notNull()static <T> @Nullable Predicate<T> Combine two predicates with a logical OR.
-
Method Details
-
all
- Type Parameters:
DATATYPE- The data type to be checked.- Returns:
- A predicate that always returns
true. Nevernull.
-
none
- Type Parameters:
DATATYPE- The data type to be checked.- Returns:
- A predicate that always returns
false. Nevernull.
-
notNull
- Type Parameters:
DATATYPE- The data type to be checked.- Returns:
- A predicate that returns
trueif the value is notnull. Nevernull.
-
isNull
- Type Parameters:
DATATYPE- The data type to be checked.- Returns:
- A predicate that returns
trueif the value isnull. Nevernull.
-
charIsEQ0
- Returns:
- A char predicate that checks for equality with 0. Never
null.
-
charIsNE0
- Returns:
- A char predicate that checks for inequality with 0. Never
null.
-
charIsGT0
- Returns:
- A char predicate that checks for values > 0. Never
null.
-
doubleIsLT0
- Returns:
- A double predicate that checks for values < 0. Never
null.
-
doubleIsLE0
- Returns:
- A double predicate that checks for values ≤ 0. Never
null.
-
doubleIsEQ0
- Returns:
- A double predicate that checks for equality with 0. Never
null.
-
doubleIsNE0
- Returns:
- A double predicate that checks for inequality with 0. Never
null.
-
doubleIsGE0
- Returns:
- A double predicate that checks for values ≥ 0. Never
null.
-
doubleIsGT0
- Returns:
- A double predicate that checks for values > 0. Never
null.
-
intIsLT0
- Returns:
- An int predicate that checks for values < 0. Never
null.
-
intIsLE0
- Returns:
- An int predicate that checks for values ≤ 0. Never
null.
-
intIsEQ0
- Returns:
- An int predicate that checks for equality with 0. Never
null.
-
intIsNE0
- Returns:
- An int predicate that checks for inequality with 0. Never
null.
-
intIsGE0
- Returns:
- An int predicate that checks for values ≥ 0. Never
null.
-
intIsGT0
- Returns:
- An int predicate that checks for values > 0. Never
null.
-
longIsLT0
- Returns:
- A long predicate that checks for values < 0. Never
null.
-
longIsLE0
- Returns:
- A long predicate that checks for values ≤ 0. Never
null.
-
longIsEQ0
- Returns:
- A long predicate that checks for equality with 0. Never
null.
-
longIsNE0
- Returns:
- A long predicate that checks for inequality with 0. Never
null.
-
longIsGE0
- Returns:
- A long predicate that checks for values ≥ 0. Never
null.
-
longIsGT0
- Returns:
- A long predicate that checks for values > 0. Never
null.
-
and
public static <T> @Nullable Predicate<T> and(@Nullable Predicate<? super T> aFirst, @Nullable Predicate<? super T> aSecond) Combine two predicates with a logical AND. If both arenull,nullis returned.- Type Parameters:
T- The data type to be checked.- Parameters:
aFirst- The first predicate. May benull.aSecond- The second predicate. May benull.- Returns:
- The combined predicate, or
nullif both arenull.
-
or
public static <T> @Nullable Predicate<T> or(@Nullable Predicate<? super T> aFirst, @Nullable Predicate<? super T> aSecond) Combine two predicates with a logical OR. If both arenull,nullis returned.- Type Parameters:
T- The data type to be checked.- Parameters:
aFirst- The first predicate. May benull.aSecond- The second predicate. May benull.- Returns:
- The combined predicate, or
nullif both arenull.
-