Java record-56-detailed description of implementation of HashSet without repeated Elements
Detailed description of HashSet Implementation of HashSet without repeated elements: public boolean add (E e) If this set does not contain the specified element, add the specified element. More specifically, if this set does not contain meet (e = null? E2 = null: e. equals (e2) element e2, then add the specified Element e to this set. If this set already contains this element, the call does not change the set and returns false. The equals method of an Object: public boolean equals (Object obj) indicates whether another Object is "equal" to this Object ". The equals method achieves equality on non-null object references: Inversion: returns true for any non-null reference values x and x. equals (x. Symmetry: For any non-null reference values x and y, x. equals (y) returns true only when y. equals (x) returns true. Passed: For any non-null reference values x, y, and z, if x. equals (y) returns true, and y. equals (z) returns true, then x. equals (z) should return true. Consistency: For any non-null reference values x and y, call x multiple times. equals (y) always returns true or false, provided that the information used in the equals comparison on the object is not modified. Returns false for any non-null reference value x, x. equals (null. The equals method of an Object implements the maximum possible equality relationship between objects. That is, for any non-null reference values x and y, if and only when x and y reference the same Object, this method returns true (x = y has a value of true ). Note: When this method is overwritten, it is usually necessary to override the hashCode method to maintain the conventional protocol of the hashCode method, which declares that equal objects must have equal hash codes.