Skip to content

Instantly share code, notes, and snippets.

@mustafayigitt
Created January 4, 2022 13:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
BaseDiffCallback is a item callback for BaseRecyclerAdapter(ListAdapter)
import androidx.recyclerview.widget.DiffUtil
class BaseDiffCallback<T : BaseComparable> : DiffUtil.ItemCallback<T>() {
override fun areItemsTheSame(oldItem: T, newItem: T) =
oldItem.id == newItem.id
override fun areContentsTheSame(oldItem: T, newItem: T) =
oldItem.equals(newItem)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment