Let's dive into the DiffUtils. The DiffUtils requires two arrays/lists, one of which should be the old list and the other should be the new list.
There are five main functions:
- getNewListSize(): This returns the size of the new list.
- getOldListSize(): This method returns the size of the old list.
- areItemsTheSame(): This method is used to determine whether two objects represent the same item.
- areContentsTheSame(): This method is used to determine whether the two objects contain the same data. In our implementation, we are returning true if both objects have the same name and image.
- getChangePayload(): When areItemsTheSame() returns true and areContentsTheSame() returns false, then DiffUtils calls this method to get the payload ...