-
Notifications
You must be signed in to change notification settings - Fork 293
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
Discussion - another method for comparing content equality in place of Item.equals()
#288
Labels
Comments
I intended to propose |
Agree with this. Also we should have a separate section regarding diffing with groupie. |
I think it's a good idea, overriding hashCode() just for this reason can be a pain and shouldn't be necessary. |
ValCanBuild
pushed a commit
that referenced
this issue
Sep 23, 2019
PR created #292 |
ValCanBuild
pushed a commit
that referenced
this issue
Sep 24, 2019
Now deployed in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like to start making more quality of life improvements in the library.
Currently to do a content comparison of two
Item
s which are the same (meaning,isSameAs
returned true for them) Groupie uses the Javaequals
method.This forces subclasses to override both
equals
andhashCode
for correct implementations and creates unnecessary boilerplate. This is especially nasty in Kotlin projects which 99% of the time don't ever override equals thanks to data classes.In the interest of a nicer API, I'd like to create a companion function to
isSameAs
that will be used for theareContentsTheSame
DiffUtil callback.My proposed name is
hasSameContentAs
but open to other suggestions.areContentsTheSame
is also an option but then the name would be different fromisSameAs
.Whatever that function is called the default implementation would use the
equals
to not break current implementations.Thoughts?
The text was updated successfully, but these errors were encountered: