This question has already been answered:
- IDEA generated equals help sort out 1 answer
Good day.
There is an example implementation of the equals () method:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vertex vertex = (Vertex) o; return Objects.equals(getId(), vertex.getId()) && getState() == vertex.getState() && Objects.equals(getVertices(), vertex.getVertices()); }
The question arises, what is the specific essence of this test?
getClass() != o.getClass()
Thank you.
if (this == o)
, has not been fulfilled? - Dmitry08