I am trying to use DiffUtil to update a RecyclerView. I have a class DataProvider which is a singleton class that holds the List which contains the Objects.
Every time I need to update the RecyclerView I modify the List in DataProvider. Now when I try to use the DiffUtil which takes two lists as parameters I don't really have the old List anymore, because I updated it.
What is the best way to keep the old List before updating it, so that I can compare them and do the needed updates on the RecyclerView without having to call notifyDataSetChanged()?