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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleaneq(int result) Evaluates the result ofa.compareTo(b)and returnsa == bstatic <T> booleaneq(Comparable<T> a, T b) a == bstatic booleange(int result) Evaluates the result ofa.compareTo(b)and returnsa >= bstatic <T> booleange(Comparable<T> a, T b) a >= bstatic booleangt(int result) Evaluates the result ofa.compareTo(b)and returnsa > bstatic <T> booleangt(Comparable<T> a, T b) a > bstatic booleanle(int result) Evaluates the result ofa.compareTo(b)and returnsa <= bstatic <T> booleanle(Comparable<T> a, T b) a <= bstatic booleanlt(int result) Evaluates the result ofa.compareTo(b)and returnsa < bstatic <T> booleanlt(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:
-