1
JavaBeginner#fundamentals
hashCode() returns an integer used by hash-based collections (HashMap, HashSet) to bucket objects. The contract states equal objects must have equal hash codes; violating this breaks hash collection behavior even if equals() is correct.
class Point {
int x, y;
public boolean equals(Object o) { /* compare x,y */ return true; }
public int hashCode() { return Objects.hash(x, y); } // must be consistent with equals
}