public static interface RepositoryPresenterCompilerStates.RPDiff<TVal,TRet>
DiffUtil.| Modifier and Type | Method and Description |
|---|---|
TRet |
diffWith(com.google.android.agera.Function<? super TVal,?> keyForItem,
boolean detectMoves)
Specifies a key extractor
Function to enable generating fine-grained events using
DiffUtil. |
@NonNull TRet diffWith(@NonNull com.google.android.agera.Function<? super TVal,?> keyForItem, boolean detectMoves)
Function to enable generating fine-grained events using
DiffUtil. Two item objects are the same item if
their keys are equal; and they have the same content if they themselves are equal. However, if the presenter is given the same instance of collection
object to generate the fine-grained events, then the presenter will consider it caused by an
update from an additional observable, and send a
blanket item change event covering all positions.
Note that DiffUtil may not be suitable for all situations due to the computation
complexity and that the computation is likely done from the main thread. If client
code has better alternatives, it should directly subclass RepositoryPresenter and
provide a custom implementation in RepositoryPresenter.getUpdates(T, T, android.support.v7.util.ListUpdateCallback).
keyForItem - A function from individual item objects to objects uniquely identifying the
items across any changes. Can be the same as the stable ID function, provided the
function does not return the same ID for multiple items (in particular
RecyclerView.NO_ID.detectMoves - The same parameter for DiffUtil.calculateDiff(Callback, boolean).RepositoryPresenter.getUpdates(T, T, android.support.v7.util.ListUpdateCallback)