TMap

final class TMap[K, V]

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

Companion:
object
class Object
trait Matchable
class Any

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.

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

Removes binding for given key.

Removes binding for given key.

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

Atomically folds using a pure function.

Atomically folds using a pure function.

def foldM[A, E](zero: A)(op: (A, (K, V)) => STM[E, A]): STM[E, A]

Atomically folds using a transactional function.

Atomically folds using a transactional function.

def foreach[E](f: (K, V) => STM[E, Unit]): STM[E, Unit]

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

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

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

Retrieves value associated with given key.

Retrieves value associated with given key.

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.

Tests if the map is empty or not

Tests if the map is empty or not

def keys: USTM[List[K]]

Collects all keys stored in map.

Collects all keys stored in map.

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

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

Stores new binding into the map.

Stores new binding into the map.

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.

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

Removes bindings matching predicate.

Removes bindings matching predicate.

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

Retains bindings matching predicate.

Retains bindings matching predicate.

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

Collects all bindings into a chunk.

Collects all bindings into a chunk.

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

Collects all bindings into a list.

Collects all bindings into a list.

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

Collects all bindings into a map.

Collects all bindings into a map.

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.

def transformM[E](f: (K, V) => STM[E, (K, V)]): STM[E, Unit]

Atomically updates all bindings using a transactional function.

Atomically updates all bindings using a transactional function.

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

Atomically updates all values using a pure function.

Atomically updates all values using a pure function.

def transformValuesM[E](f: V => STM[E, V]): STM[E, Unit]

Atomically updates all values using a transactional function.

Atomically updates all values using a transactional function.

def values: USTM[List[V]]

Collects all values stored in map.

Collects all values stored in map.

Concrete fields

val size: USTM[Int]

Returns the number of bindings.

Returns the number of bindings.