Class Comparables

java.lang.Object
org.n52.janmayen.Comparables

public final class Comparables extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Comparator<T>
    allowNull(Comparator<T> delegate)
     
    static int
    compare(boolean x, boolean y)
    Compares two boolean values.
    static int
    compare(byte x, byte y)
    Compares two byte values numerically.
    static int
    compare(char x, char y)
    Compares two char values numerically.
    static int
    compare(double x, double y)
    Compares two double values numerically.
    static int
    compare(float x, float y)
    Compares two float values numerically.
    static int
    compare(int x, int y)
    Compares two int values numerically.
    static int
    compare(long x, long y)
    Compares two long values numerically.
    static int
    compare(short x, short y)
    Compares two short values numerically.
    static <T extends Comparable<T>>
    int
    compare(T x, T y)
    Compares two values x and y.
    static int
    compareUnsignedByte(byte x, byte y)
    Compares two byte values numerically, but handle the byte value as an unsigned byte.
    static <T> com.google.common.collect.Ordering<T>
     
     
    static com.google.common.collect.Ordering<String>
     

    Methods inherited from class java.lang.Object

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

  • Method Details

    • compare

      public static int compare(int x, int y)
      Compares two int values numerically.
      Parameters:
      x - The first int to compare
      y - The second int to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(byte x, byte y)
      Compares two byte values numerically.
      Parameters:
      x - The first byte to compare
      y - The second byte to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(short x, short y)
      Compares two short values numerically.
      Parameters:
      x - The first short to compare
      y - The second short to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(char x, char y)
      Compares two char values numerically.
      Parameters:
      x - The first char to compare
      y - The second char to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(long x, long y)
      Compares two long values numerically.
      Parameters:
      x - The first long to compare
      y - The second long to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(boolean x, boolean y)
      Compares two boolean values.
      Parameters:
      x - The first boolean to compare
      y - The second boolean to compare
      Returns:
      the value 0 if x == y; a value less than 0 if !x && y; and a value greater than 0 if x && !y
      See Also:
    • compare

      public static int compare(float x, float y)
      Compares two float values numerically.
      Parameters:
      x - The first float to compare
      y - The second float to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static int compare(double x, double y)
      Compares two double values numerically.
      Parameters:
      x - The first double to compare
      y - The second double to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compare

      public static <T extends Comparable<T>> int compare(T x, T y)
      Compares two values x and y. null values are considered less than all other values.
      Type Parameters:
      T - the comparable type
      Parameters:
      x - The first value to compare
      y - The second value to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • compareUnsignedByte

      public static int compareUnsignedByte(byte x, byte y)
      Compares two byte values numerically, but handle the byte value as an unsigned byte.
      Parameters:
      x - The first byte to compare
      y - The second byte to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
      See Also:
    • allowNull

      public static <T> Comparator<T> allowNull(Comparator<T> delegate)
    • inheritance

      public static <T> com.google.common.collect.Ordering<T> inheritance()
    • version

      public static com.google.common.collect.Ordering<String> version()
    • qname

      public static Comparator<QName> qname()