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
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

def delete(k: K): USTM[Unit]

Removes binding for given key.

Removes binding for given key.

Attributes

def deleteAll(ks: Iterable[K]): USTM[Unit]

Deletes all entries associated with the specified keys.

Deletes all entries associated with the specified keys.

Attributes

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

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

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

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

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

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

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

def get(k: K): USTM[Option[V]]

Retrieves value associated with given key.

Retrieves value associated with given key.

Attributes

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

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

Tests if the map is empty or not

Tests if the map is empty or not

Attributes

def keys: USTM[List[K]]

Collects all keys stored in map.

Collects all keys stored in map.

Attributes

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

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

def put(k: K, v: V): USTM[Unit]

Stores new binding into the map.

Stores new binding into the map.

Attributes

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

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

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

Removes bindings matching predicate.

Removes bindings matching predicate.

Attributes

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

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

Retains bindings matching predicate.

Retains bindings matching predicate.

Attributes

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

def takeFirstSTM[R, E, A](pf: (K, V) => ZSTM[R, Option[E], A]): ZSTM[R, E, A]
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

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

def toChunk: USTM[Chunk[(K, V)]]

Collects all bindings into a chunk.

Collects all bindings into a chunk.

Attributes

def toList: USTM[List[(K, V)]]

Collects all bindings into a list.

Collects all bindings into a list.

Attributes

def toMap: USTM[Map[K, V]]

Collects all bindings into a map.

Collects all bindings into a map.

Attributes

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

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

def transformValues(f: V => V): USTM[Unit]

Atomically updates all values using a pure function.

Atomically updates all values using a pure function.

Attributes

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

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

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

def values: USTM[List[V]]

Collects all values stored in map.

Collects all values stored in map.

Attributes

Concrete fields

val size: USTM[Int]

Returns the number of bindings.

Returns the number of bindings.

Attributes