arrow-fx-stm / arrow.fx.stm / STM / insert
open fun <K, V>
TMap
<K, V>.insert(k: K, v: V):
Unit
Add a key value pair to the map
import arrow.fx.stm.TMap
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tmap = TMap.new<Int, String>()
atomically {
tmap.insert(10, "Hello")
}
//sampleEnd
}
open fun <A>
TSet
<A>.insert(a: A):
Unit
Adds an element to the set.
import arrow.fx.stm.TSet
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tset = TSet.new<String>()
atomically {
tset.insert("Hello")
}
//sampleEnd
}
Do you like Arrow?
✖