We are using DiffUtil.CalculateDiff
with a custom DiffUtil.Callback
to handle changes to the underlying data.
The identity of our elements is rather complex, and that's why we are using custom equality check in
areContentsTheSame
andareItemsTheSame
.However, the adapter has two things
hasStableIds
andgetItemId
.
The problem is that getItemId
returns a long
and the identity of our elements can't be conflated into a long
in a stable way (although otherwise stable considering our custom equality check in diffutil's callback.
The question is this:
What to do with hasStableIds
and getItemId
in this case, and are those at all used when DiffUtil is pushing changes to the adapter?