提交 0837f2d1 authored 作者: Jacek Ławrynowicz's avatar Jacek Ławrynowicz

performance - use addAll instead of manually adding each element

上级 69a1a3fe
......@@ -6,6 +6,7 @@
package org.h2.command.ddl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import org.h2.api.ErrorCode;
import org.h2.command.CommandInterface;
......@@ -340,9 +341,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
Column[] indexCols = idx.getColumns();
HashSet<Column> indexColsSet = new HashSet<>();
for (Column c : indexCols) {
indexColsSet.add(c);
}
Collections.addAll(indexColsSet, indexCols);
HashSet<Column> colsSet = new HashSet<>();
for (IndexColumn c : cols) {
colsSet.add(c.column);
......
......@@ -1045,9 +1045,7 @@ public class MetaTable extends Table {
// database settings
ArrayList<String> settingNames = New.arrayList();
HashMap<String, String> s = database.getSettings().getSettings();
for (String k : s.keySet()) {
settingNames.add(k);
}
settingNames.addAll(s.keySet());
Collections.sort(settingNames);
for (String k : settingNames) {
add(rows, k, s.get(k));
......
......@@ -371,9 +371,7 @@ public abstract class Table extends SchemaObjectBase {
return;
}
if (sequences != null) {
for (Sequence s : sequences) {
dependencies.add(s);
}
dependencies.addAll(sequences);
}
ExpressionVisitor visitor = ExpressionVisitor.getDependenciesVisitor(
dependencies);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论