sync

fun sync(newValues: Collection<T>): Boolean

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'.

Parameters

newValues

the new values to be synced with