Skip to content

Commit

Permalink
Merge pull request #648 from widgetii/master
Browse files Browse the repository at this point in the history
Performance fix: added capacity parameter in ArrayLists
  • Loading branch information
havocp committed Sep 3, 2019
2 parents ab89010 + 44daaf8 commit edf2eae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -59,7 +59,7 @@ private AbstractConfigValue parseConcatenation(ConfigNodeConcatenation n) {
if (flavor == ConfigSyntax.JSON)
throw new ConfigException.BugOrBroken("Found a concatenation node in JSON");

List<AbstractConfigValue> values = new ArrayList<AbstractConfigValue>();
List<AbstractConfigValue> values = new ArrayList<AbstractConfigValue>(n.children().size());

for (AbstractConfigNode node : n.children()) {
AbstractConfigValue v = null;
Expand Down
Expand Up @@ -364,7 +364,7 @@ static ConfigOrigin mergeOrigins(Collection<? extends ConfigOrigin> stack) {
Iterator<? extends ConfigOrigin> i = stack.iterator();
return mergeTwo((SimpleConfigOrigin) i.next(), (SimpleConfigOrigin) i.next());
} else {
List<SimpleConfigOrigin> remaining = new ArrayList<SimpleConfigOrigin>();
List<SimpleConfigOrigin> remaining = new ArrayList<SimpleConfigOrigin>(stack.size());
for (ConfigOrigin o : stack) {
remaining.add((SimpleConfigOrigin) o);
}
Expand Down

0 comments on commit edf2eae

Please sign in to comment.