Most common approach of updating recyclerview adapters are running loops on adapter data items and if not present. Or replace the entire data set with old+new data set and then call notifyDataSetChanged()/notifyItemRangeInserted() Something like this below
Calling notifyDataSetChanged() or any other functions to update the adapter is a costly process. The reason behind this is the adapter has to invalidate the data set and recreate the views.
A better optimised way of doing this is using DiffUtil which is available in support library >= 24 version. DiffUtil runs on Myser’s difference alogrithm with minimal updates to convert to a new list. It does not handle moving of items within list but runs another iteration to detect where it has moved. Read about it here
Let me just stop talking about it and get on with the code. Diffutil has a callback class that can implemented like this