Class JavaPredicates


  • public class JavaPredicates
    extends java.lang.Object
    Utility methods for predicates.
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaPredicates()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.function.Predicate<T> alwaysFalse()
      Return a predicate that always returns false.
      static <T> java.util.function.Predicate<T> alwaysTrue()
      Return a predicate that always returns true.
      static <T> java.util.function.Predicate<T> not​(java.util.function.Predicate<T> methodRef)
      Invert the result of a predicate.
      static <T,​R>
      java.util.function.Predicate<T>
      onResult​(java.util.function.Function<T,​? extends R> function, java.util.function.Predicate<R> predicate)
      Chain a function and a predicate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavaPredicates

        public JavaPredicates()
    • Method Detail

      • onResult

        public static <T,​R> java.util.function.Predicate<T> onResult​(java.util.function.Function<T,​? extends R> function,
                                                                           java.util.function.Predicate<R> predicate)
        Chain a function and a predicate. Useful for combining method references.
      • not

        public static <T> java.util.function.Predicate<T> not​(java.util.function.Predicate<T> methodRef)
        Invert the result of a predicate.
      • alwaysTrue

        public static <T> java.util.function.Predicate<T> alwaysTrue()
        Return a predicate that always returns true.
      • alwaysFalse

        public static <T> java.util.function.Predicate<T> alwaysFalse()
        Return a predicate that always returns false.