I am trying my hands on Room and RxJava. I fairly new to both. My code is working fine but I was interested to know about the best practices.
Imagine an object with 10 fields say
CompleteSong. In my app, I am making room return a
Flowable<List<CompleteSong>> Whenever I make an update in the database, the
Flowable updates with all the values. I am displaying that list with a
RecyclerView. I have two possibilities to proceed with i.e.
1. I can store the object that is being changed and wait for the
Flowable to update. When the flowable updates I update 1 item of
2. I can update the
RecyclerView when the
Flowable updates parsing through the list and looking for the changed instance of
I used to use the former approach, it seems to be less reactive but optimized whereas the latter seems to be more reactive but at the same time less optimized.
Can someone instruct me on this, what should be done? What approach should I follow or there’s something else that I couldn’t discover.
Note: I am new to reactive, so please consider updating me on the terminology if I messed something up.