Last active
March 5, 2017 00:38
Default implementation of a DiffUtil.Callback
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
import android.support.v7.util.DiffUtil | |
open class DiffUtilCallback<T>(val oldList: List<T>, val newList: List<T>) : DiffUtil.Callback() { | |
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) | |
= oldList[oldItemPosition] == newList[newItemPosition] | |
override fun getOldListSize() | |
= oldList.size | |
override fun getNewListSize() | |
= newList.size | |
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) | |
= oldList[oldItemPosition] == newList[newItemPosition] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment