areContentsTheSame

abstract fun areContentsTheSame(oldItem: T2, newItem: T2): Boolean(source)

Called by the SortedList when it wants to check whether two items have the same data or not. SortedList uses this information to decide whether it should call onChanged or not.

SortedList uses this method to check equality instead of equals so that you can change its behavior depending on your UI.

For example, if you are using SortedList with a RecyclerView.Adapter, you should return whether the items' visual representations are the same or not.

Return

True if the contents of the items are the same or false if they are different.

Parameters

oldItem

The previous representation of the object.

newItem

The new object that replaces the previous one.