-
-
Save mucahidkambur/599bdb78473aae8d22180a39867b0f56 to your computer and use it in GitHub Desktop.
This file contains 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
import androidx.recyclerview.widget.DiffUtil | |
class NumberDiffCallBack ( | |
private val oldNumbers: List<Int>, | |
private val newNumbers: List<Int> | |
) : DiffUtil.Callback() { | |
override fun getOldListSize(): Int = oldNumbers.size | |
override fun getNewListSize(): Int = newNumbers.size | |
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { | |
return oldNumbers[oldItemPosition] == newNumbers[newItemPosition] | |
} | |
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { | |
return oldNumbers[oldItemPosition] == newNumbers[newItemPosition] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment