public int compareTo(RdnEntry that) { int diff = type.compareToIgnoreCase(that.type); if (diff != 0) { return diff; } if (value.equals(that.value)) { // try shortcut return 0; } return getValueComparable().compareTo(that.getValueComparable()); }
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof RdnEntry)) { return false; } // Any change here must be reflected in hashCode() RdnEntry that = (RdnEntry) obj; return (type.equalsIgnoreCase(that.type)) && (getValueComparable().equals(that.getValueComparable())); }