Improved: Remove useless ‘UtilObject#compareToHelper’

(OFBIZ-11140)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mathieu Lirzin
2019-07-19 22:17:13 +00:00
parent 1427c576d5
commit 7b0053b28c
2 changed files with 0 additions and 24 deletions
@@ -96,20 +96,6 @@ public final class UtilObject {
}
}
public static <T> int compareToHelper(Comparable<T> o1, T o2) {
if (o1 == o2) {
// handles same-reference, or null
return 0;
} else if (o1 == null) {
return -1;
} else if (o2 == null) {
// either o1 or o2 is null, but not both
return 1;
} else {
return o1.compareTo(o2);
}
}
public static int doHashCode(Object o1) {
if (o1 == null) {
return 0;
@@ -235,16 +235,6 @@ public class UtilObjectTests extends GenericTestCaseBase {
}
}
public void testCompareToHelper() {
Long one = 1L;
Long two = 2L;
assertComparison("one <-> two", -1, UtilObject.compareToHelper(one, two));
assertComparison("one <-> one", 0, UtilObject.compareToHelper(one, one));
assertComparison("two <-> one", 1, UtilObject.compareToHelper(two, one));
assertComparison("one <-> null", 1, UtilObject.compareToHelper(one, null));
assertComparison("null <-> one", -1, UtilObject.compareToHelper(null, one));
}
public void testDoHashCode() throws Exception {
UtilObject.doHashCode(this);
UtilObject.doHashCode(null);