public final class Comparables extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
EQUAL |
static int |
GREATER |
static int |
LESS |
| Modifier and Type | Method and 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>> |
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> |
inheritance() |
static Comparator<QName> |
qname() |
static com.google.common.collect.Ordering<String> |
version() |
public static final int LESS
public static final int EQUAL
public static final int GREATER
public static int compare(int x,
int y)
int values numerically.x - The first int to comparey - The second int to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yInteger.compare(int, int)public static int compare(byte x,
byte y)
byte values numerically.x - The first byte to comparey - The second byte to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yByte.compare(byte, byte)public static int compare(short x,
short y)
short values numerically.x - The first short to comparey - The second short to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yShort.compare(short, short)public static int compare(char x,
char y)
char values numerically.x - The first char to comparey - The second char to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yCharacter.compare(char, char)public static int compare(long x,
long y)
long values numerically.x - The first long to comparey - The second long to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yLong.compare(long, long)public static int compare(boolean x,
boolean y)
boolean values.x - The first boolean to comparey - The second boolean to compare0 if x == y; a value less than 0 if !x && y; and a value
greater than 0 if x && !yBoolean.compare(boolean, boolean)public static int compare(float x,
float y)
float values numerically.x - The first float to comparey - The second float to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yFloat.compare(float, float)public static int compare(double x,
double y)
double values numerically.x - The first double to comparey - The second double to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yDouble.compare(double, double)public static <T extends Comparable<T>> int compare(T x, T y)
x and y. null values are considered less than all other values.T - the comparable typex - The first value to comparey - The second value to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yDouble.compare(double, double)public static int compareUnsignedByte(byte x,
byte y)
byte values numerically, but handle the byte value as an unsigned byte.x - The first byte to comparey - The second byte to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > yByte.compare(byte, byte)public static <T> Comparator<T> allowNull(Comparator<T> delegate)
public static <T> com.google.common.collect.Ordering<T> inheritance()
public static com.google.common.collect.Ordering<String> version()
public static Comparator<QName> qname()
Copyright © 2015–2021 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.