Interface ThrowingPredicate<A,T extends Throwable>
- Type Parameters:
A
- The input argument type for the predicateT
- The type ofThrowable
thrown by the predicate
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A better version of Java's
Predicate
interface that
allows for the predicates to throw whatever Throwable
is specified.- Version:
- 0.1-Alpha-SNAPSHOT
- Author:
- Logan Ferree (Tadukoo)
-
Method Summary
Modifier and TypeMethodDescriptiondefault ThrowingPredicate<A,
T> and
(ThrowingPredicate<? super A, ? extends T> other) Creates a ThrowingPredicate that will test the argument with this ThrowingPredicate and with the given ThrowingPredicate, returning true only if both results are true.static <A,
T extends Throwable>
ThrowingPredicate<A,T> Creates a ThrowingPredicate that tests if two arguments are equal according to Objects.equals(Object, Object).default ThrowingPredicate<A,
T> negate()
Creates a ThrowingPredicate that will return the opposite result of this ThrowingPredicate.default ThrowingPredicate<A,
T> or
(ThrowingPredicate<? super A, ? extends T> other) Creates a ThrowingPredicate that will test the argument with this ThrowingPredicate and with the given ThrowingPredicate, returning true if either result is true.boolean
Takes a single argument and returns a boolean.
-
Method Details
-
test
Takes a single argument and returns a boolean.- Parameters:
a
- The argument- Returns:
- A boolean
- Throws:
T
- Determined by the predicate, not required
-
and
Creates a ThrowingPredicate that will test the argument with this ThrowingPredicate and with the given ThrowingPredicate, returning true only if both results are true.- Parameters:
other
- The other ThrowingPredicate to test the argument on- Returns:
- The ThrowingPredicate that results from composing this one and the given one
-
or
Creates a ThrowingPredicate that will test the argument with this ThrowingPredicate and with the given ThrowingPredicate, returning true if either result is true.- Parameters:
other
- The other ThrowingPredicate to test the argument on- Returns:
- The ThrowingPredicate that results from composing this one and the given one
-
negate
Creates a ThrowingPredicate that will return the opposite result of this ThrowingPredicate.- Returns:
- A negated version of this ThrowingPredicate
-
isEqual
Creates a ThrowingPredicate that tests if two arguments are equal according to Objects.equals(Object, Object).- Type Parameters:
A
- The argument typeT
- TheThrowable
being thrown- Parameters:
obj
- The object to test against- Returns:
- A ThrowingPredicate that tests if two objects are equal
-