提交 56a3ab02 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use do-while loop in higherKey() and lowerKey()

上级 6bb90ad6
......@@ -1339,13 +1339,10 @@ public class TransactionStore {
* @return the result
*/
public K higherKey(K key) {
while (true) {
K k = map.higherKey(key);
if (k == null || get(k) != null) {
return k;
}
key = k;
}
do {
key = map.higherKey(key);
} while (key != null && get(key) == null);
return key;
}
/**
......@@ -1373,13 +1370,10 @@ public class TransactionStore {
* @return the result
*/
public K lowerKey(K key) {
while (true) {
K k = map.lowerKey(key);
if (k == null || get(k) != null) {
return k;
}
key = k;
}
do {
key = map.lowerKey(key);
} while (key != null && get(key) == null);
return key;
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论