Class Comparables

java.lang.Object
org.apache.cassandra.utils.Comparables

public class Comparables extends Object
Utility methods linked to comparing comparable values.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Comparable<? super T>>
    T
    max(T a, T b)
    Returns the maximum of 2 comparable values.
    static <C, T extends C>
    T
    max(T a, T b, Comparator<C> comparator)
    Returns the maximum of 2 values given a comparator of those values.
    static <T extends Comparable<? super T>>
    T
    min(T a, T b)
    Returns the minimum of 2 comparable values.
    static <C, T extends C>
    T
    min(T a, T b, Comparator<C> comparator)
    Returns the minimum of 2 values given a comparator of those values.

    Methods inherited from class java.lang.Object

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

    • Comparables

      public Comparables()
  • Method Details

    • max

      public static <T extends Comparable<? super T>> T max(T a, T b)
      Returns the maximum of 2 comparable values. On ties, returns the first argument.
    • max

      public static <C, T extends C> T max(T a, T b, Comparator<C> comparator)
      Returns the maximum of 2 values given a comparator of those values. On ties, returns the first argument.
    • min

      public static <T extends Comparable<? super T>> T min(T a, T b)
      Returns the minimum of 2 comparable values. On ties, returns the first argument.
    • min

      public static <C, T extends C> T min(T a, T b, Comparator<C> comparator)
      Returns the minimum of 2 values given a comparator of those values. On ties, returns the first argument.