I'm developing an app which involves a UI displaying a list of elements. Each element is characterised by an amount of votes.
I would like to listen to any changes that affect the list so I can update the UI. For example, I have the three following elements:
Element e1 = new Element(2); // 2 votes.
Element e2 = new Element(5); // 5 votes.
Element e3 = new Element(-3); // -3 votes.
My list will be the following after the initialization: [e2, e1, e3]
.
Let's say I downvote e1
, so the list stays the same but I want my UI to know that an element has been modified.
I've searched for a solution but couldn't find one. I bet someone has already had this issue before. Any ideas/libraries/... to offer?
Many thanks in advance!