Package software.amazon.awssdk.utils
Class ComparableUtils
java.lang.Object
software.amazon.awssdk.utils.ComparableUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
Tmaximum
(T... values) Get the maximum value from a list of comparable vales.static <T extends Comparable<T>>
Tminimum
(T... values) Get the minimum value from a list of comparable vales.static <T> int
safeCompare
(Comparable<T> d1, T d2) Does a safe comparison of twoComparable
objects accounting for nulls
-
Method Details
-
safeCompare
Does a safe comparison of twoComparable
objects accounting for nulls- Parameters:
d1
- First objectd2
- Second object- Returns:
- A positive number if the object double is larger, a negative number if the second object is larger, or 0 if they are equal. Null is considered less than any non-null value
-
minimum
Get the minimum value from a list of comparable vales.- Parameters:
values
- The values from which the minimum should be extracted.- Returns:
- The minimum value in the list.
-
maximum
Get the maximum value from a list of comparable vales.- Parameters:
values
- The values from which the maximum should be extracted.- Returns:
- The maximum value in the list.
-