Replaced private method with ObjectUtils.compare().

Former-commit-id: 16c4a5a7ed74819351bab55528442183a3244a0c
This commit is contained in:
Dale Visser
2015-06-24 15:19:24 -04:00
parent 723ba740e0
commit 414912de67

View File

@@ -226,7 +226,7 @@ public class Evidence implements Serializable, Comparable<Evidence> {
if (ObjectUtils.equals(confidence, o.confidence)) {
return 0; //they are equal
} else {
return compareToWithNullCheck(confidence, o.confidence);
return ObjectUtils.compare(confidence, o.confidence);
}
} else {
return compareToIgnoreCaseWithNullCheck(value, o.value);
@@ -258,25 +258,6 @@ public class Evidence implements Serializable, Comparable<Evidence> {
return me.compareToIgnoreCase(other);
}
/**
* Wrapper around {@link java.lang.Enum#compareTo(java.lang.Enum) Enum.compareTo} with an exhaustive, possibly duplicative,
* check against nulls.
*
* @param me the value to be compared
* @param other the other value to be compared
* @return true if the values are equal; otherwise false
*/
private int compareToWithNullCheck(Confidence me, Confidence other) {
if (me == null && other == null) {
return 0;
} else if (me == null) {
return -1; //the other string is greater then me
} else if (other == null) {
return 1; //me is greater then the other string
}
return me.compareTo(other);
}
/**
* Standard toString() implementation.
*