Class BiPredicates

java.lang.Object
eu.bandm.tools.util.java.BiPredicates

public abstract class BiPredicates extends Object
Library of constants and combinators for classes implementing BiPredicate.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A, B> BiPredicate<A,B>
    all()
    Returns a binary predicate that is true for all arguments.
    static <A, B> BiPredicate<A,B>
    complement(BiPredicate<? super A,? super B> pred)
    Returns a binary predicate that is true for all arguments where the given predicate is false and vice versa.
    static <A, B> BiPredicate<Collection<? extends A>,Collection<? extends B>>
    cover(BiPredicate<A,B> rel)
     
    static <A, B> BiPredicate<A,B>
    eq()
    Returns a binary predicate that is true if and only if the arguments are identical.
    static <A extends Comparable<? super A>>
    BiPredicate<A,A>
    Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the natural order.
    static <A> BiPredicate<A,A>
    equal(Comparator<? super A> order)
    Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the given order.
    static <A, B> BiPredicate<A,B>
    Deprecated.
    use Object::equals instead
    static <A, B> BiPredicate<A,B>
    Deprecated, for removal: This API element is subject to removal in a future version.
    use Object::equals instead
    static <A extends Comparable<? super A>>
    BiPredicate<A,A>
    Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the natural order.
    static <A> BiPredicate<A,A>
    greater(Comparator<? super A> order)
    Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the given order.
    static <A extends Comparable<? super A>>
    BiPredicate<A,A>
    Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the natural order.
    static <A> BiPredicate<A,A>
    greaterOrEqual(Comparator<? super A> order)
    Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the given order.
    static <A, B> BiPredicate<A,B>
    intersection(Collection<? extends BiPredicate<? super A,? super B>> rels)
    Returns a predicate that is true for all arguments where all of the given predicates are.
    static <A, B> BiPredicate<B,A>
    inverse(BiPredicate<? super A,? super B> pred)
    Returns a binary predicate that is true for all arguments where the given predicate is for the flipped pair of arguments.
    static <A, B> BiPredicate<A,A>
    kernel(Function<? super A,? extends B> fun, BiPredicate<? super B,? super B> pred)
     
    static <A, B, C, D>
    BiPredicate<A,C>
    kernel(Function<? super A,? extends B> left, Function<? super C,? extends D> right, BiPredicate<? super B,? super D> pred)
     
    static <A extends Comparable<? super A>>
    BiPredicate<A,A>
    Returns a binary predicate that is true if and only if the first argument is less than the second, according to the natural order.
    static <A> BiPredicate<A,A>
    less(Comparator<? super A> order)
    Returns a binary predicate that is true if and only if the first argument is less than the second, according to the given order.
    static <A extends Comparable<? super A>>
    BiPredicate<A,A>
    Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the natural order.
    static <A> BiPredicate<A,A>
    lessOrEqual(Comparator<? super A> order)
    Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the given order.
    static <A, B> BiPredicate<A,B>
    Returns a binary predicate that is false for all arguments.
    static <A, B> BiPredicate<A,B>
    union(Collection<? extends BiPredicate<? super A,? super B>> rels)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • all

      public static <A, B> BiPredicate<A,B> all()
      Returns a binary predicate that is true for all arguments.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Returns:
      a binary predicate that is true for all arguments, including null
    • none

      public static <A, B> BiPredicate<A,B> none()
      Returns a binary predicate that is false for all arguments.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Returns:
      a binary predicate that is false for all arguments, including null
    • eq

      public static <A, B> BiPredicate<A,B> eq()
      Returns a binary predicate that is true if and only if the arguments are identical.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Returns:
      a binary predicate that true if and only if the arguments are identical according to ==
    • equals

      @Deprecated(forRemoval=false, since="1.0") public static <A, B> BiPredicate<A,B> equals()
      Deprecated.
      use Object::equals instead
      Returns a binary predicate that is true if and only if the arguments are equal.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Returns:
      a binary predicate that true if and only if the arguments are equal according to Objects.equals(Object, Object)
    • equalsOrNull

      @Deprecated(forRemoval=true, since="1.0") public static <A, B> BiPredicate<A,B> equalsOrNull()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use Object::equals instead
      Returns a binary predicate that is true if and only if the arguments are equal.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Returns:
      a binary predicate that true if and only if the arguments are equal according to Objects.equals(Object, Object)
    • lessOrEqual

      public static <A> BiPredicate<A,A> lessOrEqual(Comparator<? super A> order)
      Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the given order.
      Type Parameters:
      A - the argument type
      Parameters:
      order - a comparator that specifies the desired order
      Returns:
      a binary predicate that true if and only if the first argument is less than or equal to the second according to Comparator.compare(T, T)
      Throws:
      NullPointerException - if order is null
    • lessOrEqual

      public static <A extends Comparable<? super A>> BiPredicate<A,A> lessOrEqual()
      Returns a binary predicate that is true if and only if the first argument is less than or equal to the second, according to the natural order.
      Type Parameters:
      A - the argument type
      Returns:
      a binary predicate that true if and only if the first argument is less than or equal to the second according to Comparable.compareTo(T)
    • less

      public static <A> BiPredicate<A,A> less(Comparator<? super A> order)
      Returns a binary predicate that is true if and only if the first argument is less than the second, according to the given order.
      Type Parameters:
      A - the argument type
      Parameters:
      order - a comparator that specifies the desired order
      Returns:
      a binary predicate that true if and only if the first argument is less than the second according to Comparator.compare(T, T)
      Throws:
      NullPointerException - if order is null
    • less

      public static <A extends Comparable<? super A>> BiPredicate<A,A> less()
      Returns a binary predicate that is true if and only if the first argument is less than the second, according to the natural order.
      Type Parameters:
      A - the argument type
      Returns:
      a binary predicate that true if and only if the first argument is less than the second according to Comparable.compareTo(T)
    • equal

      public static <A extends Comparable<? super A>> BiPredicate<A,A> equal()
      Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the natural order.
      Type Parameters:
      A - the argument type
      Returns:
      a binary predicate that true if and only if the first argument is equal to the second according to Comparable.compareTo(T)
    • greater

      public static <A extends Comparable<? super A>> BiPredicate<A,A> greater()
      Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the natural order.
      Type Parameters:
      A - the argument type
      Returns:
      a binary predicate that true if and only if the first argument is greater than the second according to Comparable.compareTo(T)
    • greaterOrEqual

      public static <A extends Comparable<? super A>> BiPredicate<A,A> greaterOrEqual()
      Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the natural order.
      Type Parameters:
      A - the argument type
      Returns:
      a binary predicate that true if and only if the first argument is greater than or equal to the second according to Comparable.compareTo(T)
    • greaterOrEqual

      public static <A> BiPredicate<A,A> greaterOrEqual(Comparator<? super A> order)
      Returns a binary predicate that is true if and only if the first argument is greater than or equal to the second, according to the given order.
      Type Parameters:
      A - the argument type
      Parameters:
      order - a comparator that specifies the desired order
      Returns:
      a binary predicate that true if and only if the first argument is greater than or equal to the second according to Comparator.compare(T, T)
      Throws:
      NullPointerException - if order is null
    • greater

      public static <A> BiPredicate<A,A> greater(Comparator<? super A> order)
      Returns a binary predicate that is true if and only if the first argument is greater than the second, according to the given order.
      Type Parameters:
      A - the argument type
      Parameters:
      order - a comparator that specifies the desired order
      Returns:
      a binary predicate that true if and only if the first argument is greater than the second according to Comparator.compare(T, T)
      Throws:
      NullPointerException - if order is null
    • equal

      public static <A> BiPredicate<A,A> equal(Comparator<? super A> order)
      Returns a binary predicate that is true if and only if the first argument is equal to the second, according to the given order.
      Type Parameters:
      A - the argument type
      Parameters:
      order - a comparator that specifies the desired order
      Returns:
      a binary predicate that true if and only if the first argument is equal to the second according to Comparator.compare(T, T)
      Throws:
      NullPointerException - if order is null
    • inverse

      public static <A, B> BiPredicate<B,A> inverse(BiPredicate<? super A,? super B> pred)
      Returns a binary predicate that is true for all arguments where the given predicate is for the flipped pair of arguments.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Parameters:
      pred - a binary predicate
      Returns:
      a binary predicate that is true for (a, b) if and only if pred is true for (b, a)
      Throws:
      NullPointerException - if pred is null
    • complement

      public static <A, B> BiPredicate<A,B> complement(BiPredicate<? super A,? super B> pred)
      Returns a binary predicate that is true for all arguments where the given predicate is false and vice versa.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Parameters:
      pred - a binary predicate
      Returns:
      a binary predicate that is true for all arguments where pred is false and vice versa
      Throws:
      NullPointerException - if pred is null
    • kernel

      public static <A, B, C, D> BiPredicate<A,C> kernel(Function<? super A,? extends B> left, Function<? super C,? extends D> right, BiPredicate<? super B,? super D> pred)
    • kernel

      public static <A, B> BiPredicate<A,A> kernel(Function<? super A,? extends B> fun, BiPredicate<? super B,? super B> pred)
    • cover

      public static <A, B> BiPredicate<Collection<? extends A>,Collection<? extends B>> cover(BiPredicate<A,B> rel)
    • union

      public static <A, B> BiPredicate<A,B> union(Collection<? extends BiPredicate<? super A,? super B>> rels)
    • intersection

      public static <A, B> BiPredicate<A,B> intersection(Collection<? extends BiPredicate<? super A,? super B>> rels)
      Returns a predicate that is true for all arguments where all of the given predicates are.
      Type Parameters:
      A - the first argument type
      B - the second argument type
      Parameters:
      rels - a collection of binary predicates
      Returns:
      a predicate that FIXME
      Throws:
      NullPointerException - if rels or any element of it is null