return 1;
}
int result;
final KeyedValue kv1 = (KeyedValue) o1;
final KeyedValue kv2 = (KeyedValue) o2;
if (this.type == KeyedValueComparatorType.BY_KEY) {
if (this.order.equals(SortOrder.ASCENDING)) {
result = kv1.getKey().compareTo(kv2.getKey());
} else if (this.order.equals(SortOrder.DESCENDING)) {
result = kv2.getKey().compareTo(kv1.getKey());
} else {
throw new IllegalArgumentException("Unrecognised sort order.");
}
} else if (this.type == KeyedValueComparatorType.BY_VALUE) {
final Number n1 = kv1.getValue();
final Number n2 = kv2.getValue();
if (n2 == null) {
return -1;
}
if (n1 == null) {
return 1;