Open
Description
DiffUtil is a utility class that calculates the difference between two lists and outputs a list of update operations that converts the first list into the second one.
Using notifyDataSetChanged() in RecyclerView doesn’t let it track the exact changes. As a result, all visible views are needlessly rebuilt, which is inefficient and time-consuming.
By using DiffUtil, we can compare the old and new lists more efficiently. This way, only the specific items that have changed are updated, avoiding the full rebuild.