Created
February 19, 2019 19:11
-
-
Save nxsyed/27947bf40938473418112614d6d9a523 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SpotDiffCallback( | |
| private val old: List<Spot>, | |
| private val new: List<Spot> | |
| ) : DiffUtil.Callback() { | |
| override fun getOldListSize(): Int { | |
| return old.size | |
| } | |
| override fun getNewListSize(): Int { | |
| return new.size | |
| } | |
| override fun areItemsTheSame(oldPosition: Int, newPosition: Int): Boolean { | |
| return old[oldPosition].id == new[newPosition].id | |
| } | |
| override fun areContentsTheSame(oldPosition: Int, newPosition: Int): Boolean { | |
| return old[oldPosition] == new[newPosition] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment