Skip to main content

equals() and hashCode() Contract

Learn equals() and hashCode() Contract (Advanced Java Concepts, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

1. Introduction Equals defines logical equality and hashCode returns an int used by hash collections . They must be consistent: equal objects have equal hash codes .

More lessons in Advanced Java Concepts