Interface ThrowingPredicate<A,T extends Throwable>

Type Parameters:
A - The input argument type for the predicate
T - The type of Throwable 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.

@FunctionalInterface public interface ThrowingPredicate<A,T extends Throwable>
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 Type
    Method
    Description
    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).
    Creates a ThrowingPredicate that will return the opposite result of this ThrowingPredicate.
    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
    test(A a)
    Takes a single argument and returns a boolean.
  • Method Details

    • test

      boolean test(A a) throws T
      Takes a single argument and returns a boolean.
      Parameters:
      a - The argument
      Returns:
      A boolean
      Throws:
      T - Determined by the predicate, not required
    • and

      default 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.
      Parameters:
      other - The other ThrowingPredicate to test the argument on
      Returns:
      The ThrowingPredicate that results from composing this one and the given one
    • or

      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.
      Parameters:
      other - The other ThrowingPredicate to test the argument on
      Returns:
      The ThrowingPredicate that results from composing this one and the given one
    • negate

      default ThrowingPredicate<A,T> negate()
      Creates a ThrowingPredicate that will return the opposite result of this ThrowingPredicate.
      Returns:
      A negated version of this ThrowingPredicate
    • isEqual

      static <A, T extends Throwable> ThrowingPredicate<A,T> isEqual(Object obj)
      Creates a ThrowingPredicate that tests if two arguments are equal according to Objects.equals(Object, Object).
      Type Parameters:
      A - The argument type
      T - The Throwable being thrown
      Parameters:
      obj - The object to test against
      Returns:
      A ThrowingPredicate that tests if two objects are equal