Skip to content
Snippets Groups Projects
Commit 6d9932ce authored by dgelessus's avatar dgelessus
Browse files

Remove a few more ArrayList initial capacities

If anything, it seems to be *faster* with the default initial
capacities, but the difference is not very significant.
parent a524d8e5
Branches
Tags
No related merge requests found
...@@ -585,7 +585,7 @@ public final class Grammar ...@@ -585,7 +585,7 @@ public final class Grammar
if(!symbol.terminal) if(!symbol.terminal)
{ {
List<Symbol> tailVector = new ArrayList<>(0); List<Symbol> tailVector = new ArrayList<>();
for(int k = items[i].lr0Item.position + 1; k < rightside.length; k++) for(int k = items[i].lr0Item.position + 1; k < rightside.length; k++)
{ {
......
...@@ -14,10 +14,10 @@ import java.util.TreeMap; ...@@ -14,10 +14,10 @@ import java.util.TreeMap;
final class LR0Collection final class LR0Collection
{ {
private final List<LR0ItemSet> sets = new ArrayList<>(0); private final List<LR0ItemSet> sets = new ArrayList<>();
private final Map<LR0ItemSet, Integer> setIndices = new TreeMap<>(); private final Map<LR0ItemSet, Integer> setIndices = new TreeMap<>();
private final List<Map<Symbol, Integer>> GOTO = new ArrayList<>(0); private final List<Map<Symbol, Integer>> GOTO = new ArrayList<>();
final List<String> names = new ArrayList<>(0); final List<String> names = new ArrayList<>();
LR0Collection(LR0ItemSet set LR0Collection(LR0ItemSet set
) )
......
...@@ -96,7 +96,7 @@ final class Production ...@@ -96,7 +96,7 @@ final class Production
if(result == null) if(result == null)
{ {
List<Production> alternatives = new ArrayList<>(0); List<Production> alternatives = new ArrayList<>();
for(Production production : productions) for(Production production : productions)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment