@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Node)) return false; Node<?> node = (Node<?>) o; if (getId() != node.getId()) return false; return !(getData() != null ? !getData().equals(node.getData()) : node.getData() != null); }
public Node(Node otherNode) { this.id = otherNode.getId(); this.data = (T) otherNode.getData(); }