Interface Predicate<A>

Type Parameters:
A - The argument type
All Superinterfaces:
Applicative<Boolean,Fn1<A,?>>, Cartesian<A,Boolean,Fn1<?,?>>, Cocartesian<A,Boolean,Fn1<?,?>>, Contravariant<A,Profunctor<?,Boolean,Fn1<?,?>>>, Fn1<A,Boolean>, Functor<Boolean,Fn1<A,?>>, Monad<Boolean,Fn1<A,?>>, MonadReader<A,Boolean,Fn1<A,?>>, MonadRec<Boolean,Fn1<A,?>>, MonadWriter<A,Boolean,Fn1<A,?>>, Profunctor<A,Boolean,Fn1<?,?>>
All Known Implementing Classes:
Empty
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 Predicate<A> extends Fn1<A,Boolean>
A specialized Fn1 that returns a Boolean.
  • Method Details

    • diMapL

      default <Z> Predicate<Z> diMapL(Fn1<? super Z,? extends A> fn)
      Contravariantly map over the argument to this function, producing a function that takes the new argument type, and produces the same result.
      Specified by:
      diMapL in interface Cartesian<A,Boolean,Fn1<?,?>>
      Specified by:
      diMapL in interface Cocartesian<A,Boolean,Fn1<?,?>>
      Specified by:
      diMapL in interface Fn1<A,Boolean>
      Specified by:
      diMapL in interface Profunctor<A,Boolean,Fn1<?,?>>
      Type Parameters:
      Z - the new argument type
      Parameters:
      fn - the contravariant argument mapping function
      Returns:
      an Fn1<Z, B>
    • contraMap

      default <Z> Predicate<Z> contraMap(Fn1<? super Z,? extends A> fn)
      Contravariantly map A <- B.
      Specified by:
      contraMap in interface Cartesian<A,Boolean,Fn1<?,?>>
      Specified by:
      contraMap in interface Cocartesian<A,Boolean,Fn1<?,?>>
      Specified by:
      contraMap in interface Contravariant<A,Profunctor<?,Boolean,Fn1<?,?>>>
      Specified by:
      contraMap in interface Fn1<A,Boolean>
      Specified by:
      contraMap in interface Profunctor<A,Boolean,Fn1<?,?>>
      Type Parameters:
      Z - the new parameter type
      Parameters:
      fn - the mapping function
      Returns:
      the mapped Contravariant functor instance
    • widen

      default <Z> BiPredicate<Z,A> widen()
      Widen this function's argument list by prepending an ignored argument of any type to the front.
      Specified by:
      widen in interface Fn1<A,Boolean>
      Type Parameters:
      Z - the new first argument type
      Returns:
      the widened function
    • discardR

      default <C> Predicate<A> discardR(Applicative<C,Fn1<A,?>> appB)
      Sequence both this Applicative and appB, discarding appB's result and returning this Applicative. This is generally useful for sequentially performing side-effects.
      Specified by:
      discardR in interface Applicative<Boolean,Fn1<A,?>>
      Specified by:
      discardR in interface Fn1<A,Boolean>
      Specified by:
      discardR in interface Monad<Boolean,Fn1<A,?>>
      Specified by:
      discardR in interface MonadReader<A,Boolean,Fn1<A,?>>
      Specified by:
      discardR in interface MonadRec<Boolean,Fn1<A,?>>
      Specified by:
      discardR in interface MonadWriter<A,Boolean,Fn1<A,?>>
      Type Parameters:
      C - the type of appB's parameter
      Parameters:
      appB - the other Applicative
      Returns:
      this Applicative
    • compose

      default <Y, Z> BiPredicate<Y,Z> compose(Fn2<? super Y,? super Z,? extends A> before)
      Right-to-left composition between different arity functions. Preserves highest arity in the return type.
      Specified by:
      compose in interface Fn1<A,Boolean>
      Type Parameters:
      Y - the resulting function's first argument type
      Z - the resulting function's second argument type
      Parameters:
      before - the function to pass its return value to this function's input
      Returns:
      an Fn2<Y, Z, B>
    • and

      default Predicate<A> and(Predicate<? super A> other)
      Left-to-right short-circuiting logical conjunction.
      Parameters:
      other - the predicate to test if this one succeeds
      Returns:
      a predicate representing the conjunction of this predicate and other
    • or

      default Predicate<A> or(Predicate<? super A> other)
      Left-to-right short-circuiting logical disjunction.
      Parameters:
      other - the predicate to test if this one fails
      Returns:
      a predicate representing the disjunction of this predicate and other
    • negate

      default Predicate<A> negate()
      Logical negation.
      Returns:
      the negation of this predicate
    • toPredicate

      default Predicate<A> toPredicate()
      Convert this Predicate to a java Predicate.
      Returns:
      the Predicate
    • predicate

      static <A> Predicate<A> predicate(Fn1<? super A,? extends Boolean> predicate)
      Static factory method to create a predicate from an Fn1.
      Type Parameters:
      A - the input type
      Parameters:
      predicate - the Fn1
      Returns:
      the predicate
    • fromPredicate

      static <A> Predicate<A> fromPredicate(Predicate<A> predicate)
      Create a Predicate from a java Predicate.
      Type Parameters:
      A - the input type
      Parameters:
      predicate - the java Predicate
      Returns:
      the Predicate