Use if-else

This commit is contained in:
Gary Gregory 2024-06-23 14:19:07 -04:00
parent 7e152d4935
commit 1835a52a8e
1 changed files with 8 additions and 14 deletions

View File

@ -774,13 +774,11 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
Map.Entry<K, V> e = null;
if (fromKey == null) {
e = firstEntry();
} else {
if (fromInclusive) {
} else if (fromInclusive) {
e = ceilingEntry(fromKey);
} else {
e = higherEntry(fromKey);
}
}
final K first = e != null ? e.getKey() : null;
if (e == null || toKey != null && !inToRange(first, false)) {
@ -814,13 +812,11 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
final Map.Entry<K, V> e;
if (toKey == null) {
e = lastEntry();
} else {
if (toInclusive) {
} else if (toInclusive) {
e = floorEntry(toKey);
} else {
e = lowerEntry(toKey);
}
}
final K last = e != null ? e.getKey() : null;
if (e == null || fromKey != null && !inFromRange(last, false)) {
@ -2314,11 +2310,9 @@ public abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
if (selectR(h.left, h.bitIndex, key, lengthInBits, reference)) {
return selectR(h.right, h.bitIndex, key, lengthInBits, reference);
}
} else {
if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) {
} else if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) {
return selectR(h.left, h.bitIndex, key, lengthInBits, reference);
}
}
return false;
}