Package-level declarations

Functions

Link copied to clipboard
fun <T> MutableCollection<T>.mergeIfNotContained(collectionToMerge: Collection<T>)

Method used to merge items from the collectionToMerge collection that are not present in the main collection. For example:

Link copied to clipboard
fun <T> MutableCollection<T>.retainAndAdd(supportCollection: Collection<T>)

Method split in two phases used to first remove all the items from the main collection that are not present in the supportCollection, then add all the items present in the same support collection but not in the main one. For example:

Link copied to clipboard
fun <T> MutableCollection<T>.toggle(element: T, add: Boolean = !contains(element))

Method used to add an element to a MutableCollection if it is not already contained or remove that element if already contained by the collection. The default behavior of the method is checking the existence in the collection of the element to toggle, but it can be used also to dynamically insert or remove an element from the collection from example with checkbox selection, button clicking, etc...