public class DiffObservableList<T>
extends java.util.AbstractList<T>
ObservableList that uses DiffUtil to calculate and dispatch it's change
updates. Note: Consider using AsyncDiffObservableList instead as it will automatically
diff in a background thread.| Modifier and Type | Class and Description |
|---|---|
static interface |
DiffObservableList.Callback<T>
Deprecated.
Use
DiffUtil.ItemCallback instead. |
| Constructor and Description |
|---|
DiffObservableList(<any> callback)
Creates a new DiffObservableList of type T.
|
DiffObservableList(<any> callback,
boolean detectMoves)
Creates a new DiffObservableList of type T.
|
DiffObservableList(DiffObservableList.Callback<T> callback)
Deprecated.
The same behavior can be obtained with
#DiffObservableList(DiffUtil.ItemCallback),
though you may consider using AsyncDiffObservableList instead. |
DiffObservableList(DiffObservableList.Callback<T> callback,
boolean detectMoves)
Deprecated.
The same behavior can be obtained with
#DiffObservableList(DiffUtil.ItemCallback, boolean),
though you may consider using AsyncDiffObservableList instead. |
| Modifier and Type | Method and Description |
|---|---|
void |
addOnListChangedCallback(<any> listener) |
DiffUtil.DiffResult |
calculateDiff(java.util.List<T> newItems)
Calculates the list of update operations that can convert this list into the given one.
|
T |
get(int i) |
void |
removeOnListChangedCallback(<any> listener) |
int |
size() |
void |
update(java.util.List<T> newItems)
Sets this list to the given items.
|
void |
update(java.util.List<T> newItems,
DiffUtil.DiffResult diffResult)
Updates the contents of this list to the given one using the DiffResults to dispatch change
notifications.
|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, wait@Deprecated public DiffObservableList(DiffObservableList.Callback<T> callback)
#DiffObservableList(DiffUtil.ItemCallback),
though you may consider using AsyncDiffObservableList instead.callback - The callback that controls the behavior of the DiffObservableList.@Deprecated public DiffObservableList(DiffObservableList.Callback<T> callback, boolean detectMoves)
#DiffObservableList(DiffUtil.ItemCallback, boolean),
though you may consider using AsyncDiffObservableList instead.callback - The callback that controls the behavior of the DiffObservableList.detectMoves - True if DiffUtil should try to detect moved items, false otherwise.public DiffObservableList(<any> callback)
callback - The callback that controls the behavior of the DiffObservableList.public DiffObservableList(<any> callback,
boolean detectMoves)
callback - The callback that controls the behavior of the DiffObservableList.detectMoves - True if DiffUtil should try to detect moved items, false otherwise.public DiffUtil.DiffResult calculateDiff(java.util.List<T> newItems)
newItems - The items that this list will be set to.public void update(java.util.List<T> newItems, DiffUtil.DiffResult diffResult)
newItems - The items to set this list to.diffResult - The diff results to dispatch change notifications.public void update(java.util.List<T> newItems)
calculateDiff(List) followed by update(List, DiffUtil.DiffResult).
Warning! If the lists are large this operation may be too slow for the main thread. In
that case, you should call calculateDiff(List) on a background thread and then
update(List, DiffUtil.DiffResult) on the main thread.
newItems - The items to set this list to.public void addOnListChangedCallback(<any> listener)
public void removeOnListChangedCallback(<any> listener)
public T get(int i)