Hey LeNDuyA, both scenarios would do the job.
With option one you would have to change your Adapter class’s super class from RecyclerViewAdapter to ListAdapter. The ListAdapter class has the submitList() method.
Based not the docs, the ListAdapter is just a wrapper to the AsyncListDiffer class which has the submitList() method. Also, the example uses LiveData as well to update the list with the new updated data (not a requirement but kool).
Now you don’t necessarily need to use submitList method to update the list. If you are using LiveData you can simply observe the changes, assign your old list reference to the new List from the LiveData and simply call notifyDataSetChange() within the onChange() method. The LiveData link has an example you can use as a reference.
I’ll leave you with a file from one of my earlier projects where I used option 2 to update my list of Data. FYI, it is by no means perfect and it is written in java. Also, I created a new Adapter in this case whenever the list is updated so you would have to figure out how to omit that detail.
I haven’t had a chance to look at the 4th edition yet. I read the 3rd edition and love it! Hopefully, I’m leading you in the right direction and not making matters worse.