Title: Java Eclipse - Equals And HashCode
Description: This video demonstrates the use of the methods equals and hashCode. These methods exist in the Object class. We create a Car class (with VIN, make, model, and year), that overrides equals and hashCode. These methods are needed to get the hashvalue of an object specially when it is stored in a hashtable or hashmap, and to test if two objects are equal. By default,Java tests the equality of two objects by comparing their references. Most of the time, this type of comparison is not enough, that is why we implement the equals method. It is always a good practice to implement equals and hashCode together.
Methodology: Good coding standards and object-oriented design.
Technologies: Java, object-oriented programming.
Examples constructed: We built a Car class that overrides equals and hashCode from the Object class. Then we created a test class with a main method that instantiates the Car class and calls the appropriate methods.
Keywords: class, equals, hashCode, Object, identityHashCode.