commonMain.ru.casperix.signals.collection.ObservableCollectionFactory.kt Maven / Gradle / Ivy
package ru.casperix.signals.collection
fun observableListOf(vararg items: T): ObservableMutableList {
val result = ObservableMutableList()
result.addAll(items)
return result
}
fun observableUniqueListOf(vararg items: T): ObservableMutableList {
val result = ObservableMutableList(true)
result.addAll(items)
return result
}
fun observableSetOf(vararg items: T): ObservableMutableSet {
val result = ObservableMutableSet()
result.addAll(items)
return result
}
fun observableMapOf(vararg pairs: Pair): ObservableMutableMap {
val result = ObservableMutableMap()
pairs.forEach {
result.put(it.first, it.second)
}
return result
}
fun List.toObservableList(): ObservableMutableList {
val result = ObservableMutableList()
result.addAll(this)
return result
}
fun List.toUniqueObservableList(): ObservableMutableList {
val result = ObservableMutableList(true)
result.addAll(this)
return result
}
fun Map.toObservableMap(): ObservableMutableMap {
val result = ObservableMutableMap()
result.putAll(this)
return result
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy