Package org.hisp.dhis.util
Class Comparing
java.lang.Object
org.hisp.dhis.util.Comparing
Generic utility class for null-safe comparison.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
intcompareTo(T a, T b) Compares two objects for order.static <T extends Comparable<T>>
intcompareToNullLast(T a, T b) Compares two objects for order.
-
Constructor Details
-
Comparing
public Comparing()
-
-
Method Details
-
compareTo
Compares two objects for order. Returns a negative integer, zero, or a positive integer if the first object is less than, equal to, or greater than the second object. Any of the objects can be null. A null value is considered to be less than a non-null value.- Type Parameters:
T- the type.- Parameters:
a- the first object.b- the second object.- Returns:
- an integer value.
-
compareToNullLast
Compares two objects for order. Returns a negative integer, zero, or a positive integer if the first object is less than, equal to, or greater than the second object. Any of the objects can be null. A null value is considered to be greater than a non-null value.- Type Parameters:
T- the type.- Parameters:
a- the first object.b- the second object.- Returns:
- an integer value.
-