Skip to content

Commit afd2466

Browse files
committed
[refactor] DoubleValue.createComparisonWith
- instantly return IntSupplier
1 parent 9e78c73 commit afd2466

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

exist-core/src/main/java/org/exist/xquery/value/DoubleValue.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,19 @@ public boolean isPositive() {
146146

147147
@Override
148148
protected @Nullable IntSupplier createComparisonWith(final NumericValue other) {
149-
final IntSupplier comparison;
150149
if (other instanceof IntegerValue) {
151-
comparison = () -> BigDecimal.valueOf(value).compareTo(new BigDecimal(((IntegerValue) other).value));
152-
} else if (other instanceof DecimalValue) {
153-
comparison = () -> BigDecimal.valueOf(value).compareTo(((DecimalValue) other).value);
154-
} else if (other instanceof DoubleValue) {
155-
comparison = () -> Double.compare(value, ((DoubleValue) other).value);
156-
} else if (other instanceof FloatValue) {
157-
comparison = () -> Double.compare(value, ((FloatValue) other).value);
158-
} else {
159-
return null;
160-
}
161-
return comparison;
150+
return () -> BigDecimal.valueOf(value).compareTo(new BigDecimal(((IntegerValue) other).value));
151+
}
152+
if (other instanceof DecimalValue) {
153+
return () -> BigDecimal.valueOf(value).compareTo(((DecimalValue) other).value);
154+
}
155+
if (other instanceof DoubleValue) {
156+
return () -> Double.compare(value, ((DoubleValue) other).value);
157+
}
158+
if (other instanceof FloatValue) {
159+
return () -> Double.compare(value, ((FloatValue) other).value);
160+
}
161+
return null;
162162
}
163163

164164
@Override

0 commit comments

Comments
 (0)