Interface CheckedPredicate<T>

  • Type Parameters:
    T - the type of the input to 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 CheckedPredicate<T>
    A Predicate which may throw.
    • Method Detail

      • not

        static <T> CheckedPredicate<T> not​(CheckedPredicate<? super T> that)
        Negates a given predicate by calling that.negate().
        Type Parameters:
        T - argument type of that
        Parameters:
        that - a predicate
        Returns:
        the negation of the given predicate that
        Throws:
        java.lang.NullPointerException - if the given predicate that is null
      • test

        boolean test​(T t)
              throws java.lang.Exception
        Evaluates this predicate on the given argument.
        Parameters:
        t - the input argument
        Returns:
        true if the input argument matches the predicate, otherwise false
        Throws:
        java.lang.Exception - if an error occurs
      • and

        default CheckedPredicate<T> and​(CheckedPredicate<? super T> that)
        Combines this predicate with that predicate using logical and (&&).
        Parameters:
        that - a CheckedPredicate
        Returns:
        a new CheckedPredicate with p1.and(p2).test(t) == true :<=> p1.test(t) && p2.test(t) == true
        Throws:
        java.lang.NullPointerException - if the given predicate that is null
      • negate

        default CheckedPredicate<T> negate()
        Negates this predicate.
        Returns:
        A new CheckedPredicate with p.negate().test(t) == true :<=> p.test(t) == false
      • or

        default CheckedPredicate<T> or​(CheckedPredicate<? super T> that)
        Combines this predicate with that predicate using logical or (||).
        Parameters:
        that - a CheckedPredicate
        Returns:
        a new CheckedPredicate with p1.or(p2).test(t) :<=> p1.test(t) || p2.test(t)
        Throws:
        java.lang.NullPointerException - if the given predicate that is null