Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This class overrides "equals()" and should therefore also override "hashCode()". #5879

Closed
MinaQin opened this issue May 12, 2022 · 1 comment · Fixed by #6257
Closed

This class overrides "equals()" and should therefore also override "hashCode()". #5879

MinaQin opened this issue May 12, 2022 · 1 comment · Fixed by #6257

Comments

@MinaQin
Copy link
Contributor

MinaQin commented May 12, 2022

Code Path:confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/auth/AuthorReq.java
image
According to the Java Language Specification, there is a contract between equals(Object) and hashCode():

If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.

It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results.

However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.

In order to comply with this contract, those methods should be either both inherited, or both overridden.

@chakkk309
Copy link

Hi, I want to try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants