Skip to content

Commit f3dc3a3

Browse files
committed
Replace LinkedList by ArrayList for efficiency
1 parent 83c59ef commit f3dc3a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/pathexpression/PathExpressionComputer.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.google.common.collect.Table;
1919
import pathexpression.RegEx.EmptySet;
2020

21+
import java.util.ArrayList;
2122
import java.util.HashMap;
2223
import java.util.LinkedList;
2324
import java.util.List;
@@ -72,7 +73,7 @@ private List<IRegEx<V>> computeAllPathFrom(N a) {
7273
eliminate();
7374
logger.debug("Compute all path from {}", a);
7475
List<PathExpression<V>> extractPathSequence = extractPathSequence();
75-
List<IRegEx<V>> regEx = new LinkedList<>();
76+
List<IRegEx<V>> regEx = new ArrayList<>();
7677
for (int i = 0; i < graph.getNodes().size(); i++) {
7778
regEx.add(emptyRegEx);
7879
}
@@ -104,10 +105,8 @@ private List<IRegEx<V>> computeAllPathFrom(N a) {
104105
}
105106

106107
private List<PathExpression<V>> extractPathSequence() {
107-
108-
109108
int n = graph.getNodes().size();
110-
List<PathExpression<V>> list = new LinkedList<PathExpression<V>>();
109+
List<PathExpression<V>> list = new ArrayList<PathExpression<V>>();
111110
for (int u = 1; u <= n; u++) {
112111
for (int w = u; w <= n; w++) {
113112
IRegEx<V> reg = table.get(u, w);

0 commit comments

Comments
 (0)