Created
June 5, 2019 17:45
-
-
Save spmallette/b78226680f108dd714f983c34069bcd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Number min(final Number a, final Number b) { | |
return isNonValue(a) ? b : | |
isNonValue(b) ? a : | |
getHelper(getHighestCommonNumberClass(a, b)).min.apply(a, b); | |
} | |
public static Comparable min(final Comparable a, final Comparable b) { | |
if (a instanceof Number && b instanceof Number) { | |
return min((Number) a, (Number) b); | |
} | |
return isNonValue(a) ? b : | |
isNonValue(b) ? a : | |
a.compareTo(b) < 0 ? a : b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment