Author: mthl
Date: Fri Jul 19 22:17:13 2019
New Revision: 1863445
URL:
http://svn.apache.org/viewvc?rev=1863445&view=revLog:
Improved: Remove useless ‘UtilObject#compareToHelper’
(OFBIZ-11140)
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java?rev=1863445&r1=1863444&r2=1863445&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java Fri Jul 19 22:17:13 2019
@@ -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;
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java?rev=1863445&r1=1863444&r2=1863445&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilObjectTests.java Fri Jul 19 22:17:13 2019
@@ -235,16 +235,6 @@ public class UtilObjectTests extends Gen
}
}
- 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);