SortedList.Callback

public static abstract class SortedList.Callback
extends Object implements Comparator<T2>, ListUpdateCallback

java.lang.Object
   ↳ androidx.recyclerview.widget.SortedList.Callback<T2>


The class that controls the behavior of the SortedList.

It defines how items should be sorted and how duplicates should be handled.

SortedList calls the callback methods on this class to notify changes about the underlying data.

Summary

Public constructors

Callback()

Public methods

abstract boolean areContentsTheSame(T2 oldItem, T2 newItem)

Called by the SortedList when it wants to check whether two items have the same data or not.

abstract boolean areItemsTheSame(T2 item1, T2 item2)

Called by the SortedList to decide whether two objects represent the same Item or not.

abstract int compare(T2 o1, T2 o2)

Similar to Comparator.compare(Object, Object), should compare two and return how they should be ordered.

Object getChangePayload(T2 item1, T2 item2)

When areItemsTheSame(T2, T2) returns true for two items and areContentsTheSame(T2, T2) returns false for them, SortedList.Callback calls this method to get a payload about the change.

void onChanged(int position, int count, Object payload)

Called when count number of items are updated at the given position.

abstract void onChanged(int position, int count)

Called by the SortedList when the item at the given position is updated.

Inherited methods

Public constructors

Callback

public Callback ()