Skip to content

Instantly share code, notes, and snippets.

@iammert
Created August 20, 2016 16:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iammert/76aee53fdb540173a0a4db19da6f0d18 to your computer and use it in GitHub Desktop.
Save iammert/76aee53fdb540173a0a4db19da6f0d18 to your computer and use it in GitHub Desktop.
public void updateList(ArrayList<Person> newList) {
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new MyDiffCallback(this.persons, newList));
diffResult.dispatchUpdatesTo(this);
}
@anandwana001
Copy link

anandwana001 commented Jun 29, 2020

@iammert Didn't we need to do something like this?

val result = DiffUtil.calculateDiff(
   RecyclerDataDiffCallback(dataList, newDataList),
   false
 )
 dataList.clear()
 dataList += newDataList.toMutableList()
 result.dispatchUpdatesTo(this) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment