I created my DiffUtil like this:
class DiffUtilCall extends DiffUtil.ItemCallback<Cars> {
@Override
public boolean areItemsTheSame(@NonNull Cars oldItem, @NonNull Cars newItem) {
return oldItem.getTitle().equals(newItem.getTitle());
}
@Override
public boolean areContentsTheSame(@NonNull Cars oldItem, @NonNull Cars newItem) {
return true;
}
I want to keep refernce to my oldList, so I could "restart" my updated list.
I tried to do this:
private List<Cars> orList;
And than initiaze in the constructor:
public CarsRecyclerViewAdapter() {
super(new DiffUtilCall());
orList = getCurrentList()
}
But I just getting an empty list.
How can I solve this?