aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/util/DirectedGraph.java5
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);
}