@Test public void testEquals() { UndirectedEdge<Ip> edge1 = new UndirectedEdge<>(Ip.ZERO, Ip.ZERO); UndirectedEdge<Ip> edge2 = new UndirectedEdge<>(Ip.ZERO, Ip.FIRST_CLASS_A_PRIVATE_IP); UndirectedEdge<Ip> edge3 = new UndirectedEdge<>(Ip.FIRST_CLASS_B_PRIVATE_IP, Ip.FIRST_CLASS_A_PRIVATE_IP); new EqualsTester() .addEqualityGroup(new Object()) .addEqualityGroup(edge1, edge1, new UndirectedEdge<>(Ip.ZERO, Ip.ZERO)) .addEqualityGroup(edge2) .addEqualityGroup(edge3) .testEquals(); }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof UndirectedEdge)) { return false; } UndirectedEdge<?> rhs = (UndirectedEdge<?>) obj; return _nodeU.equals(rhs._nodeU) && _nodeV.equals(rhs._nodeV); }
UndirectedEdge { @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof UndirectedEdge)) { return false; } UndirectedEdge<?> rhs = (UndirectedEdge<?>) obj; return _nodeU.equals(rhs._nodeU) && _nodeV.equals(rhs._nodeV); } }
UndirectedEdge { @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof UndirectedEdge)) { return false; } UndirectedEdge<?> rhs = (UndirectedEdge<?>) obj; return _nodeU.equals(rhs._nodeU) && _nodeV.equals(rhs._nodeV); } UndirectedEdge(N nodeU, N nodeV); }
UndirectedEdge { @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof UndirectedEdge)) { return false; } UndirectedEdge<?> rhs = (UndirectedEdge<?>) obj; return _nodeU.equals(rhs._nodeU) && _nodeV.equals(rhs._nodeV); } UndirectedEdge(N nodeU, N nodeV); @JsonProperty(PROP_NODE_U) @Nonnull N getNodeU(); @JsonProperty(PROP_NODE_V) @Nonnull N getNodeV(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); }
UndirectedEdge { @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof UndirectedEdge)) { return false; } UndirectedEdge<?> rhs = (UndirectedEdge<?>) obj; return _nodeU.equals(rhs._nodeU) && _nodeV.equals(rhs._nodeV); } UndirectedEdge(N nodeU, N nodeV); @JsonProperty(PROP_NODE_U) @Nonnull N getNodeU(); @JsonProperty(PROP_NODE_V) @Nonnull N getNodeV(); @Override boolean equals(@Nullable Object obj); @Override int hashCode();  }