Class PredicateUtil
java.lang.Object
de.tomatengames.util.PredicateUtil
-
Method Details
-
not
Returns the logical negation of the specifiedPredicate.- Type Parameters:
T- The type of the input parameter.- Parameters:
pred- The predicate that should be negated. Must not benull.- Returns:
- The logical negation of the specified predicate.
- Throws:
NullPointerException- If the specified predicate isnull.
-
and
public static <T> @NotNull Predicate<T> and(@NotNull Predicate<? super T> pred1, @NotNull Predicate<? super T> pred2) Returns aPredicatethat represents(pred1.test(t) && pred2.test(t)).- Type Parameters:
T- The type of the input parameter.- Parameters:
pred1- The first predicate. Must not benull.pred2- The second predicate. Must not benull.- Returns:
- A predicate that combines both predicates with a logical AND.
- Throws:
NullPointerException- If a specified predicate isnull.
-
or
public static <T> @NotNull Predicate<T> or(@NotNull Predicate<? super T> pred1, @NotNull Predicate<? super T> pred2) Returns aPredicatethat represents(pred1.test(t) || pred2.test(t)).- Type Parameters:
T- The type of the input parameter.- Parameters:
pred1- The first predicate. Must not benull.pred2- The second predicate. Must not benull.- Returns:
- A predicate that combines both predicates with a logical OR.
- Throws:
NullPointerException- If a specified predicate isnull.
-