//arrow-fx-stm/arrow.fx.stm/STM/lookup

lookup

common open fun <K, V> TMap<K, V>.lookup(k: K): V?

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")
}


If the key is not present [STM.lookup](lookup.html) will not retry, instead it returns `null`.


Do you like Arrow?

Arrow Org
<