Viewable List
class ViewableList<T : Any>(storage: MutableList<T> = mutableListOf()) : IMutableViewableList<T>
Content copied to clipboard
Constructors
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun adviseAddRemove(lifetime: Lifetime, handler: (AddRemove, Int, T) -> Unit)
Content copied to clipboard
Adds a subscription to additions and removals of list elements. When a list element is updated, the handler is called twice: to report the removal of the old element and the addition of the new one.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Synchronizes the viewable list by adding missing elements and removing unmatched elements. If the order of equal values is not changed, then they won't be modified. However, even if equal elements exist in both lists, but order is swapped, then they will be removed and re-added to satisfy the new values order. It helps drastically reduce the number of change events if the collection is unmodified at all or just a few elements are changed compared to the classical approach with 'clear' and 'addAll'.
Link copied to clipboard