diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2015-12-23 21:09:00 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2015-12-23 21:09:00 +0200 |
commit | add3cb7357bf454cd67c68faee87a6d32f8730ca (patch) | |
tree | 42e134bc52fd86aa610045249d1947351cae564c | |
parent | 8eb2c195c95199423730e6a0732ea025dab5554f (diff) | |
download | pf4j-add3cb7357bf454cd67c68faee87a6d32f8730ca.tar.gz pf4j-add3cb7357bf454cd67c68faee87a6d32f8730ca.zip |
fix #83
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java b/pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java index 08a90bf..e51d354 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java @@ -38,6 +38,7 @@ public class DirectedGraph<V> { if (neighbors.containsKey(vertex)) { return; } + neighbors.put(vertex, new ArrayList<V>()); } @@ -66,13 +67,15 @@ public class DirectedGraph<V> { if (!(this.containsVertex(from) && this.containsVertex(to))) { throw new IllegalArgumentException("Nonexistent vertex"); } + neighbors.get(from).remove(to); } public List<V> getNeighbors(V vertex) { - if (neighbors.containsKey(vertex)) { + if (!neighbors.containsKey(vertex)) { return new ArrayList<V>(); } + return neighbors.get(vertex); } |