zak.taccardi
04/13/2017, 4:24 PMEmailEntity is POJO for how an email is stored in the database. EmailViewModel is POJO for how email is displayed in UI
1. I have a list of 1000 emails in a database table, EmailTable
2. must display them in a RecyclerView.
3. EmailDb repository class emits a List<EmailEntity>> (size == 1000)
4. List<EmailEntity> of 1000 emails is mapped into a List<EmailViewModel>
5. List<EmailViewModel> is displayed in the View.
6. User reads email, marking it as read.
7. EmailTable record is updated to indicate email was read
8. EmailDb emits a new List<EmailEntity>> of the 1000 emails
9. List<EmailEnitity> is mapped to a new List<EmailViewModel>
Steps #8 and #9 allocate 2000 new objects for 1 mutation (email being marked as read). How do you avoid this while still using unidirectional data flow and rx?