@@ -83,31 +83,7 @@ <h5>enum Animal</h5>
8383 < span class ="returntype "> int</ span >
8484 < span class ="name "> hashCode</ span > </ section >
8585
86- < section class ="desc markdown ">
87- < p > The hash code for this object.</ p >
88- < p > A hash code is a single integer which represents the state of the object
89- that affects < code > ==</ code > comparisons.</ p >
90- < p > All objects have hash codes.
91- The default hash code represents only the identity of the object,
92- the same way as the default < code > ==</ code > implementation only considers objects
93- equal if they are identical (see < code > identityHashCode</ code > ).</ p >
94- < p > If < code > ==</ code > is overridden to use the object state instead,
95- the hash code must also be changed to represent that state.</ p >
96- < p > Hash codes must be the same for objects that are equal to each other
97- according to < code > ==</ code > .
98- The hash code of an object should only change if the object changes
99- in a way that affects equality.
100- There are no further requirements for the hash codes.
101- They need not be consistent between executions of the same program
102- and there are no distribution guarantees.</ p >
103- < p > Objects that are not equal are allowed to have the same hash code,
104- it is even technically allowed that all instances have the same hash code,
105- but if clashes happen too often, it may reduce the efficiency of hash-based
106- data structures like < code > HashSet</ code > or < code > HashMap</ code > .</ p >
107- < p > If a subclass overrides < code > hashCode</ code > , it should override the
108- < code > ==</ code > operator as well to maintain consistency.</ p >
109- </ section >
110- </ section >
86+ </ section >
11187
11288
11389
0 commit comments