Package com.peterphi.std.types
Class CompareHelper
java.lang.Object
com.peterphi.std.types.CompareHelper
Makes the use of Java's ugly compareTo operation a little more readable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
eq
(int result) Evaluates the result ofa.compareTo(b)
and returnsa == b
static <T> boolean
eq
(Comparable<T> a, T b) a == b
static boolean
ge
(int result) Evaluates the result ofa.compareTo(b)
and returnsa >= b
static <T> boolean
ge
(Comparable<T> a, T b) a >= b
static boolean
gt
(int result) Evaluates the result ofa.compareTo(b)
and returnsa > b
static <T> boolean
gt
(Comparable<T> a, T b) a > b
static boolean
le
(int result) Evaluates the result ofa.compareTo(b)
and returnsa <= b
static <T> boolean
le
(Comparable<T> a, T b) a <= b
static boolean
lt
(int result) Evaluates the result ofa.compareTo(b)
and returnsa < b
static <T> boolean
lt
(Comparable<T> a, T b) a < b
-
Constructor Details
-
CompareHelper
public CompareHelper()
-
-
Method Details
-
lt
public static boolean lt(int result) Evaluates the result ofa.compareTo(b)
and returnsa < b
- Parameters:
result
-- Returns:
-
eq
public static boolean eq(int result) Evaluates the result ofa.compareTo(b)
and returnsa == b
- Parameters:
result
-- Returns:
-
le
public static boolean le(int result) Evaluates the result ofa.compareTo(b)
and returnsa <= b
- Parameters:
result
-- Returns:
-
gt
public static boolean gt(int result) Evaluates the result ofa.compareTo(b)
and returnsa > b
- Parameters:
result
-- Returns:
-
ge
public static boolean ge(int result) Evaluates the result ofa.compareTo(b)
and returnsa >= b
- Parameters:
result
-- Returns:
-
lt
a < b
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- true if a < b
-
le
a <= b
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- true if a <= b
-
gt
a > b
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- true if a > b
-
ge
a >= b
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
- true if a >= b
-
eq
a == b
- Type Parameters:
T
-- Parameters:
a
-b
-- Returns:
-