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