lookup
Lookup a value at the specific key k
import arrow.fx.stm.TMap
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tmap = TMap.new<Int, String>()
val result = atomically {
tmap[1] = "Hello"
tmap[2] = "World"
tmap.lookup(1)
}
//sampleEnd
println("Result $result")
}
Content copied to clipboard
If the key is not present STM.lookup will not retry, instead it returns
null
.