提交 630aaa81 authored 作者: Andrei Tokar's avatar Andrei Tokar

MVMap.sizeAsLong() MVMap.empty()

上级 c9318893
...@@ -995,15 +995,12 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -995,15 +995,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @return the number of entries * @return the number of entries
*/ */
public final long sizeAsLong() { public final long sizeAsLong() {
RootReference rootReference = getRoot(); return getRoot().getTotalCount();
return rootReference.root.getTotalCount() + rootReference.getAppendCounter();
} }
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
RootReference rootReference = getRoot(); return sizeAsLong() == 0;
Page rootPage = rootReference.root;
return rootPage.isLeaf() && rootPage.getKeyCount() == 0 && rootReference.getAppendCounter() == 0;
} }
public final long getCreateVersion() { public final long getCreateVersion() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论