-
Notifications
You must be signed in to change notification settings - Fork 34
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
== and hashcode generation #154
Comments
How do we handle hashCode? |
We need to override hashCode and == operator
We can use quiver/core to override easily the hashCode
…On Tue, Aug 28, 2018, 17:42 Ravi Teja Gudapati ***@***.***> wrote:
How do we handle hashCode?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFLtgLqDQAlVZbTQMCOIKh2KXM2wieC3ks5uVWTUgaJpZM4WP0ID>
.
|
Having an annotation at model level @GenModelHelper or something to override == and hashcode, in addition a clone and toString methods would be just a feature killer for me^^ |
Ok. But how do we compute hashCode? |
When using IntelliJ, it can generate those with some shortcut, here is what it generate:
So it's quite easy to generate I'll say :) just list all fields with |
Shouldnt it be:
What happens when there is a an iterable or a map? |
Hum yes looks more right, on map/iterable IntelliJ does the same, just .hashCode on them, maybe worth taking a look at how built_value is doing it ? |
Would be nice to have == and hashcode generated for us as it's annoying to make them each time we change the model
The text was updated successfully, but these errors were encountered: