diff --git a/src/main/java/info/debatty/java/graphs/Neighbor.java b/src/main/java/info/debatty/java/graphs/Neighbor.java index 7bc3eba..369171d 100644 --- a/src/main/java/info/debatty/java/graphs/Neighbor.java +++ b/src/main/java/info/debatty/java/graphs/Neighbor.java @@ -71,6 +71,10 @@ public int hashCode() { @Override public int compareTo(Object other) { + if (other == null) { + return 1; + } + if (!other.getClass().isInstance(this)) { throw new InvalidParameterException(); }