Package org.n52.janmayen
Class Comparables
- java.lang.Object
-
- org.n52.janmayen.Comparables
-
public final class Comparables extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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>inheritance()static Comparator<QName>qname()static com.google.common.collect.Ordering<String>version()
-
-
-
Field Detail
-
LESS
public static final int LESS
- See Also:
- Constant Field Values
-
EQUAL
public static final int EQUAL
- See Also:
- Constant Field Values
-
GREATER
public static final int GREATER
- See Also:
- Constant Field Values
-
-
Method Detail
-
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:
Integer.compare(int, int)
-
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:
Byte.compare(byte, byte)
-
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:
Short.compare(short, short)
-
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:
Character.compare(char, char)
-
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:
Long.compare(long, long)
-
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:
Boolean.compare(boolean, boolean)
-
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:
Float.compare(float, float)
-
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:
Double.compare(double, double)
-
compare
public static <T extends Comparable<T>> int compare(T x, T y)
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:
Double.compare(double, double)
-
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:
Byte.compare(byte, byte)
-
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()
-
-