Created
April 6, 2017 01:52
-
-
Save kmshack/e501d6c020c160adffe93e5d82b31dfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomRecyclerViewAdapter extends RecyclerView.Adapter<CustomRecyclerViewAdapter.ViewHolder> { | |
... | |
public void updateEmployeeListItems(List<Employee> employees) { | |
final EmployeeDiffCallback diffCallback = new EmployeeDiffCallback(this.mEmployees, employees); | |
final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback); | |
this.mEmployees.clear(); | |
this.mEmployees.addAll(employees); | |
diffResult.dispatchUpdatesTo(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment