Skip to content

Commit 7b0053b

Browse files
committed
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
1 parent 1427c57 commit 7b0053b

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,6 @@ public static Object getObjectException(byte[] bytes) throws ClassNotFoundExcept
9696
}
9797
}
9898

99-
public static <T> int compareToHelper(Comparable<T> o1, T o2) {
100-
if (o1 == o2) {
101-
// handles same-reference, or null
102-
return 0;
103-
} else if (o1 == null) {
104-
return -1;
105-
} else if (o2 == null) {
106-
// either o1 or o2 is null, but not both
107-
return 1;
108-
} else {
109-
return o1.compareTo(o2);
110-
}
111-
}
112-
11399
public static int doHashCode(Object o1) {
114100
if (o1 == null) {
115101
return 0;

framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,6 @@ public void testGetByteCount() throws Exception {
235235
}
236236
}
237237

238-
public void testCompareToHelper() {
239-
Long one = 1L;
240-
Long two = 2L;
241-
assertComparison("one <-> two", -1, UtilObject.compareToHelper(one, two));
242-
assertComparison("one <-> one", 0, UtilObject.compareToHelper(one, one));
243-
assertComparison("two <-> one", 1, UtilObject.compareToHelper(two, one));
244-
assertComparison("one <-> null", 1, UtilObject.compareToHelper(one, null));
245-
assertComparison("null <-> one", -1, UtilObject.compareToHelper(null, one));
246-
}
247-
248238
public void testDoHashCode() throws Exception {
249239
UtilObject.doHashCode(this);
250240
UtilObject.doHashCode(null);

0 commit comments

Comments
 (0)