Skip to content

Commit

Permalink
Apply reviews: make availableVertices a TIntHashSet
Browse files Browse the repository at this point in the history
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Mar 9, 2020
1 parent ac0dfc3 commit f06a295
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.powsybl.commons.PowsyblException;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.list.linked.TIntLinkedList;
import gnu.trove.set.hash.TIntHashSet;

import java.io.PrintStream;
import java.util.*;
Expand Down Expand Up @@ -97,7 +98,7 @@ public String toString() {

private final Lock adjacencyListCacheLock = new ReentrantLock();

private final TIntLinkedList availableVertices = new TIntLinkedList();
private final TIntHashSet availableVertices = new TIntHashSet();

private final TIntLinkedList removedEdges = new TIntLinkedList();

Expand All @@ -120,9 +121,10 @@ public int addVertex() {
int v;
if (availableVertices.isEmpty()) {
v = vertices.size();
vertices.add(new Vertex<V>());
vertices.add(new Vertex<>());
} else {
v = availableVertices.removeAt(0);
v = availableVertices.iterator().next();
availableVertices.remove(v);
}
invalidateAdjacencyList();
notifyListener();
Expand Down

0 comments on commit f06a295

Please sign in to comment.