TMap

zio.stm.TMap
See theTMap companion object
final class TMap[K, V]

Transactional map implemented on top of TRef and TArray. Resolves conflicts via chaining.

Attributes

Companion
object
Source
TMap.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def contains(k: K): USTM[Boolean]

Tests whether or not map contains a key.

Tests whether or not map contains a key.

Attributes

Source
TMap.scala
def delete(k: K): USTM[Unit]

Removes binding for given key.

Removes binding for given key.

Attributes

Source
TMap.scala
def deleteAll(ks: Iterable[K]): USTM[Unit]

Deletes all entries associated with the specified keys.

Deletes all entries associated with the specified keys.

Attributes

Source
TMap.scala
def find[A](pf: PartialFunction[(K, V), A]): USTM[Option[A]]

Finds the key/value pair matching the specified predicate, and uses the provided function to extract a value out of it.

Finds the key/value pair matching the specified predicate, and uses the provided function to extract a value out of it.

Attributes

Source
TMap.scala
def findAll[A](pf: PartialFunction[(K, V), A]): USTM[Chunk[A]]

Finds all the key/value pairs matching the specified predicate, and uses the provided function to extract values out them.

Finds all the key/value pairs matching the specified predicate, and uses the provided function to extract values out them.

Attributes

Source
TMap.scala
def findAllSTM[R, E, A](pf: (K, V) => ZSTM[R, Option[E], A]): ZSTM[R, E, Chunk[A]]

Finds all the key/value pairs matching the specified predicate, and uses the provided effectful function to extract values out of them..

Finds all the key/value pairs matching the specified predicate, and uses the provided effectful function to extract values out of them..

Attributes

Source
TMap.scala
def findSTM[R, E, A](f: (K, V) => ZSTM[R, Option[E], A]): ZSTM[R, E, Option[A]]

Finds the key/value pair matching the specified predicate, and uses the provided effectful function to extract a value out of it.

Finds the key/value pair matching the specified predicate, and uses the provided effectful function to extract a value out of it.

Attributes

Source
TMap.scala
def fold[A](zero: A)(op: (A, (K, V)) => A): USTM[A]

Atomically folds using a pure function.

Atomically folds using a pure function.

Attributes

Source
TMap.scala
def foldSTM[R, E, A](zero: A)(op: (A, (K, V)) => ZSTM[R, E, A]): ZSTM[R, E, A]

Atomically folds using a transactional function.

Atomically folds using a transactional function.

Attributes

Source
TMap.scala
def foreach[R, E](f: (K, V) => ZSTM[R, E, Unit]): ZSTM[R, E, Unit]

Atomically performs transactional-effect for each binding present in map.

Atomically performs transactional-effect for each binding present in map.

Attributes

Source
TMap.scala
def get(k: K): USTM[Option[V]]

Retrieves value associated with given key.

Retrieves value associated with given key.

Attributes

Source
TMap.scala
def getOrElse(k: K, default: => V): USTM[V]

Retrieves value associated with given key or default value, in case the key isn't present.

Retrieves value associated with given key or default value, in case the key isn't present.

Attributes

Source
TMap.scala
def getOrElseSTM[R, E](k: K, default: => ZSTM[R, E, V]): ZSTM[R, E, V]

Retrieves value associated with given key or transactional default value, in case the key isn't present.

Retrieves value associated with given key or transactional default value, in case the key isn't present.

Attributes

Source
TMap.scala

Tests if the map is empty or not

Tests if the map is empty or not

Attributes

Source
TMap.scala
def keys: USTM[List[K]]

Collects all keys stored in map.

Collects all keys stored in map.

Attributes

Source
TMap.scala
def merge(k: K, v: V)(f: (V, V) => V): USTM[V]

If the key k is not already associated with a value, stores the provided value, otherwise merge the existing value with the new one using function f and store the result

If the key k is not already associated with a value, stores the provided value, otherwise merge the existing value with the new one using function f and store the result

Attributes

Source
TMap.scala
def mergeSTM[R, E](k: K, v: V)(f: (V, V) => ZSTM[R, E, V]): ZSTM[R, E, V]

If the key k is not already associated with a value, stores the provided value, otherwise merge the existing value with the new one using transactional function f and store the result

If the key k is not already associated with a value, stores the provided value, otherwise merge the existing value with the new one using transactional function f and store the result

Attributes

Source
TMap.scala
def put(k: K, v: V): USTM[Unit]

Stores new binding into the map.

Stores new binding into the map.

Attributes

Source
TMap.scala
def putIfAbsent(k: K, v: V): USTM[Unit]

Stores new binding in the map if it does not already exist.

Stores new binding in the map if it does not already exist.

Attributes

Source
TMap.scala
def removeIf(p: (K, V) => Boolean): USTM[Chunk[(K, V)]]

Removes bindings matching predicate and returns the removed entries.

Removes bindings matching predicate and returns the removed entries.

Attributes

Source
TMap.scala
def removeIfDiscard(p: (K, V) => Boolean): USTM[Unit]

Removes bindings matching predicate.

Removes bindings matching predicate.

Attributes

Source
TMap.scala
def retainIf(p: (K, V) => Boolean): USTM[Chunk[(K, V)]]

Retains bindings matching predicate and returns removed bindings.

Retains bindings matching predicate and returns removed bindings.

Attributes

Source
TMap.scala
def retainIfDiscard(p: (K, V) => Boolean): USTM[Unit]

Retains bindings matching predicate.

Retains bindings matching predicate.

Attributes

Source
TMap.scala
def takeFirst[A](pf: PartialFunction[(K, V), A]): USTM[A]

Takes the first matching value, or retries until there is one.

Takes the first matching value, or retries until there is one.

Attributes

Source
TMap.scala
def takeFirstSTM[R, E, A](pf: (K, V) => ZSTM[R, Option[E], A]): ZSTM[R, E, A]

Attributes

Source
TMap.scala
def takeSome[A](pf: PartialFunction[(K, V), A]): USTM[NonEmptyChunk[A]]

Takes all matching values, or retries until there is at least one.

Takes all matching values, or retries until there is at least one.

Attributes

Source
TMap.scala
def takeSomeSTM[R, E, A](pf: (K, V) => ZSTM[R, Option[E], A]): ZSTM[R, E, NonEmptyChunk[A]]

Takes all matching values, or retries until there is at least one.

Takes all matching values, or retries until there is at least one.

Attributes

Source
TMap.scala
def toChunk: USTM[Chunk[(K, V)]]

Collects all bindings into a chunk.

Collects all bindings into a chunk.

Attributes

Source
TMap.scala
def toList: USTM[List[(K, V)]]

Collects all bindings into a list.

Collects all bindings into a list.

Attributes

Source
TMap.scala
def toMap: USTM[Map[K, V]]

Collects all bindings into a map.

Collects all bindings into a map.

Attributes

Source
TMap.scala
def transform(f: (K, V) => (K, V)): USTM[Unit]

Atomically updates all bindings using a pure function.

Atomically updates all bindings using a pure function.

Attributes

Source
TMap.scala
def transformSTM[R, E](f: (K, V) => ZSTM[R, E, (K, V)]): ZSTM[R, E, Unit]

Atomically updates all bindings using a transactional function.

Atomically updates all bindings using a transactional function.

Attributes

Source
TMap.scala
def transformValues(f: V => V): USTM[Unit]

Atomically updates all values using a pure function.

Atomically updates all values using a pure function.

Attributes

Source
TMap.scala
def transformValuesSTM[R, E](f: V => ZSTM[R, E, V]): ZSTM[R, E, Unit]

Atomically updates all values using a transactional function.

Atomically updates all values using a transactional function.

Attributes

Source
TMap.scala
def updateWith(k: K)(f: (Option[V]) => Option[V]): USTM[Option[V]]

Updates the mapping for the specified key with the specified function, which takes the current value of the key as an input, if it exists, and either returns Some with a new value to indicate to update the value in the map or None to remove the value from the map. Returns Some with the updated value or None if the value was removed from the map.

Updates the mapping for the specified key with the specified function, which takes the current value of the key as an input, if it exists, and either returns Some with a new value to indicate to update the value in the map or None to remove the value from the map. Returns Some with the updated value or None if the value was removed from the map.

Attributes

Source
TMap.scala
def updateWithSTM[R, E](k: K)(f: (Option[V]) => ZSTM[R, E, Option[V]]): ZSTM[R, E, Option[V]]

Updates the mapping for the specified key with the specified transactional function, which takes the current value of the key as an input, if it exists, and either returns Some with a new value to indicate to update the value in the map or None to remove the value from the map. Returns Some with the updated value or None if the value was removed from the map.

Updates the mapping for the specified key with the specified transactional function, which takes the current value of the key as an input, if it exists, and either returns Some with a new value to indicate to update the value in the map or None to remove the value from the map. Returns Some with the updated value or None if the value was removed from the map.

Attributes

Source
TMap.scala
def values: USTM[List[V]]

Collects all values stored in map.

Collects all values stored in map.

Attributes

Source
TMap.scala

Concrete fields

val size: USTM[Int]

Returns the number of bindings.

Returns the number of bindings.

Attributes

Source
TMap.scala