Interface AsyncPredicate<T>

All Superinterfaces:
AsyncPredicateEx<T>
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 AsyncPredicate<T> extends AsyncPredicateEx<T>
  • Method Details

    • test

      Promise<Boolean> test(T t)
      Specified by:
      test in interface AsyncPredicateEx<T>
    • of

      static <T> AsyncPredicate<T> of(io.activej.common.function.PredicateEx<T> predicate)
      Wraps a PredicateEx interface.
      Parameters:
      predicate - a PredicateEx
      Returns:
      AsyncPredicate that works on top of PredicateEx interface
    • sanitize

      static <T> AsyncPredicate<T> sanitize(AsyncPredicateEx<T> predicate)
    • alwaysTrue

      static <T> AsyncPredicate<T> alwaysTrue()
      Returns an AsyncPredicate that always returns promise of true
    • alwaysFalse

      static <T> AsyncPredicate<T> alwaysFalse()
      Returns an AsyncPredicate that always returns promise of false
    • not

      static <T> AsyncPredicate<T> not(AsyncPredicate<? super T> predicate)
      Negates a given AsyncPredicate
      Parameters:
      predicate - an original AsyncPredicate
      Returns:
      an AsyncPredicate that represents a logical negation of original predicate
    • negate

      default AsyncPredicate<T> negate()
      Negates this AsyncPredicate
      Returns:
      an AsyncPredicate that represents a logical negation of this predicate
    • and

      default AsyncPredicate<T> and(AsyncPredicate<? super T> other)
      Returns a composed AsyncPredicate that represents a logical AND of this asynchronous predicate and the other

      Unlike Java's Predicate.and(Predicate) this method does not provide short-circuit. If either this or other predicate returns an exceptionally completed promise, the combined asynchronous predicate also returns an exceptionally completed promise

      Parameters:
      other - other AsyncPredicate that will be logically ANDed with this predicate
      Returns:
      a composed AsyncPredicate that represents a logical AND of this asynchronous predicate and the other
    • or

      default AsyncPredicate<T> or(AsyncPredicate<? super T> other)
      Returns a composed AsyncPredicate that represents a logical OR of this asynchronous predicate and the other

      Unlike Java's Predicate.or(Predicate) this method does not provide short-circuit. If either this or other predicate returns an exceptionally completed promise, the combined asynchronous predicate also returns an exceptionally completed promise

      Parameters:
      other - other AsyncPredicate that will be logically ORed with this predicate
      Returns:
      a composed AsyncPredicate that represents a logical OR of this asynchronous predicate and the other