Package org.n52.janmayen
Class Comparables
java.lang.Object
org.n52.janmayen.Comparables
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Comparator<T> allowNull(Comparator<T> delegate) static intcompare(boolean x, boolean y) Compares twobooleanvalues.static intcompare(byte x, byte y) Compares twobytevalues numerically.static intcompare(char x, char y) Compares twocharvalues numerically.static intcompare(double x, double y) Compares twodoublevalues numerically.static intcompare(float x, float y) Compares twofloatvalues numerically.static intcompare(int x, int y) Compares twointvalues numerically.static intcompare(long x, long y) Compares twolongvalues numerically.static intcompare(short x, short y) Compares twoshortvalues numerically.static <T extends Comparable<T>>
intcompare(T x, T y) Compares two valuesxandy.static intcompareUnsignedByte(byte x, byte y) Compares twobytevalues numerically, but handle thebytevalue as an unsigned byte.static <T> com.google.common.collect.Ordering<T> static Comparator<QName> qname()static com.google.common.collect.Ordering<String> version()
-
Field Details
-
LESS
public static final int LESS- See Also:
-
EQUAL
public static final int EQUAL- See Also:
-
GREATER
public static final int GREATER- See Also:
-
-
Method Details
-
compare
public static int compare(int x, int y) Compares twointvalues numerically.- Parameters:
x- The firstintto comparey- The secondintto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(byte x, byte y) Compares twobytevalues numerically.- Parameters:
x- The firstbyteto comparey- The secondbyteto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(short x, short y) Compares twoshortvalues numerically.- Parameters:
x- The firstshortto comparey- The secondshortto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(char x, char y) Compares twocharvalues numerically.- Parameters:
x- The firstcharto comparey- The secondcharto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(long x, long y) Compares twolongvalues numerically.- Parameters:
x- The firstlongto comparey- The secondlongto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(boolean x, boolean y) Compares twobooleanvalues.- Parameters:
x- The firstbooleanto comparey- The secondbooleanto compare- Returns:
- the value
0ifx == y; a value less than0if!x && y; and a value greater than0ifx && !y - See Also:
-
compare
public static int compare(float x, float y) Compares twofloatvalues numerically.- Parameters:
x- The firstfloatto comparey- The secondfloatto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
public static int compare(double x, double y) Compares twodoublevalues numerically.- Parameters:
x- The firstdoubleto comparey- The seconddoubleto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compare
Compares two valuesxandy.nullvalues are considered less than all other values.- Type Parameters:
T- the comparable type- Parameters:
x- The first value to comparey- The second value to compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
compareUnsignedByte
public static int compareUnsignedByte(byte x, byte y) Compares twobytevalues numerically, but handle thebytevalue as an unsigned byte.- Parameters:
x- The firstbyteto comparey- The secondbyteto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y - See Also:
-
allowNull
-
inheritance
public static <T> com.google.common.collect.Ordering<T> inheritance() -
version
-
qname
-