arrow-fx-stm / arrow.fx.stm / STM / remove

remove

open fun <K, V> TMap<K, V>.remove(k: K): Unit

Remove a key value pair from a map

import arrow.fx.stm.TMap
import arrow.fx.stm.atomically

suspend fun main() {
  //sampleStart
  val tmap = TMap.new<Int, String>()
  atomically {
    tmap[1] = "Hello"
    tmap.remove(1)
  }
  //sampleEnd
}

open fun <A> TSet<A>.remove(a: A): Unit

Remove an element from 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")
    tset.remove("Hello")
  }
  //sampleEnd
}

Do you like Arrow?

Arrow Org
<