You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I noticed that this bug will only trigger for objects which define an equals() but not hashcode(). But there is a similar class, where a class defines neither, which is a potential bug as well. The user may intend for two "equal" objects to hash to the same value, but the actual equals() and hashCode() implementations come from the base Object class. So only the object reference address will be used in equality, nothing particular about the object instances themselves.
A class defines an equals(Object) method but not a hashCode() method, and thus doesn't fulfill the requirement that equal objects have equal hashCodes. An instance of this class is used in a hash data structure, making the need to fix this problem of highest importance.
The text was updated successfully, but these errors were encountered:
Hi, I noticed that this bug will only trigger for objects which define an equals() but not hashcode(). But there is a similar class, where a class defines neither, which is a potential bug as well. The user may intend for two "equal" objects to hash to the same value, but the actual equals() and hashCode() implementations come from the base Object class. So only the object reference address will be used in equality, nothing particular about the object instances themselves.
HE: Use of class without a hashCode() method in a hashed data structure
A class defines an equals(Object) method but not a hashCode() method, and thus doesn't fulfill the requirement that equal objects have equal hashCodes. An instance of this class is used in a hash data structure, making the need to fix this problem of highest importance.
The text was updated successfully, but these errors were encountered: