提交 262be8b2 authored 作者: Noel Grandin's avatar Noel Grandin

walk this ValueHashMap using entries() method

since it seems to be more efficient than repeated lookups
上级 cec23b76
...@@ -7,6 +7,7 @@ package org.h2.expression; ...@@ -7,6 +7,7 @@ package org.h2.expression;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.Map;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.util.ValueHashMap; import org.h2.util.ValueHashMap;
...@@ -47,9 +48,9 @@ class AggregateDataHistogram extends AggregateData { ...@@ -47,9 +48,9 @@ class AggregateDataHistogram extends AggregateData {
} }
ValueArray[] values = new ValueArray[distinctValues.size()]; ValueArray[] values = new ValueArray[distinctValues.size()];
int i = 0; int i = 0;
for (Value dv : distinctValues.keys()) { for (Map.Entry<Value,AggregateDataHistogram> entry : distinctValues.entries()) {
AggregateDataHistogram d = distinctValues.get(dv); AggregateDataHistogram d = entry.getValue();
values[i] = ValueArray.get(new Value[] { dv, ValueLong.get(d.count) }); values[i] = ValueArray.get(new Value[] { entry.getKey(), ValueLong.get(d.count) });
i++; i++;
} }
final CompareMode compareMode = database.getCompareMode(); final CompareMode compareMode = database.getCompareMode();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论