MutHashMap
Definitions
Updates the value at key k
using function f
if the key exists.
Does nothing if the key does not exist.
def adjustWithKey(f: k -> (v -> v \ ef), k: k, m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceUpdates the value at key k
using function f
with key if the key exists.
Does nothing if the key does not exist.
def clear(m: MutHashMap[k, v, r]): Unit \ r
SourceRemoves all entries from m
.
def copy(rc: Region[r2], m: MutHashMap[k, v, r1]): MutHashMap[k, v, r2] \ r1 + r2 with Eq[k], Hash[k]
SourceReturns a shallow copy of m
in region rc2
.
All key-value pairs are copied in insertion order.
def count(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Int32 \ ef + r
SourceReturns the number of key-value pairs in m
that satisfy the predicate f
.
def empty(rc: Region[r]): MutHashMap[k, v, r] \ r
SourceReturns an empty MutHashMap.
def emptyWithCapacity(rc: Region[r], capacity: Int32): MutHashMap[k, v, r] \ r
SourceReturns an empty mutable hash map with the given capacity.
The capacity is rounded up to the minimum capacity.
def exists(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Bool \ ef + r
SourceReturns true
if at least one key-value pair in m
satisfies the predicate f
.
def find(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Option[(k, v)] \ ef + r
SourceReturns the first key-value pair in m
(in insertion order) that satisfies the predicate f
.
Alias for findLeft
.
def findLeft(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Option[(k, v)] \ ef + r
SourceReturns the first key-value pair in m
(from left, in insertion order) that satisfies the predicate f
.
def findRight(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Option[(k, v)] \ ef + r
SourceReturns the first key-value pair in m
(from right, in reverse insertion order) that satisfies the predicate f
.
def first(m: MutHashMap[k, v, r]): Option[(k, v)] \ r
SourceReturns the first key-value pair that was inserted into the mutable map m
.
Returns None
if the map is empty.
def firstKey(m: MutHashMap[k, v, r]): Option[k] \ r
SourceReturns the first key that was inserted into the mutable map m
.
Returns None
if the map is empty.
def firstValue(m: MutHashMap[k, v, r]): Option[v] \ r
SourceReturns the first value that was inserted into the mutable map m
.
Returns None
if the map is empty.
def foldLeft(f: b -> (v -> b \ ef), s: b, m: MutHashMap[k, v, r]): b \ ef + r
SourceApplies f
to a start value s
and all values in m
going from left to right (insertion order).
def foldLeftWithKey(f: b -> (k -> (v -> b \ ef)), s: b, m: MutHashMap[k, v, r]): b \ ef + r
SourceApplies f
to a start value s
and all key-value pairs in m
going from left to right (insertion order).
Returns the result of mapping each value and combining the results using a monoid.
def foldRight(f: v -> (b -> b \ ef), s: b, m: MutHashMap[k, v, r]): b \ ef + r
SourceApplies f
to a start value s
and all values in m
going from right to left (reverse insertion order).
def foldRightWithKey(f: k -> (v -> (b -> b \ ef)), s: b, m: MutHashMap[k, v, r]): b \ ef + r
SourceApplies f
to a start value s
and all key-value pairs in m
going from right to left (reverse insertion order).
def forAll(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Bool \ ef + r
SourceReturns true
if all key-value pairs in m
satisfy the predicate f
.
def forEach(f: k -> (v -> Unit \ ef), m: MutHashMap[k, v, r]): Unit \ ef + r
SourceApplies f
to each key-value pair in m
in insertion order.
def forEachWithIndex(f: Int32 -> (k -> (v -> Unit \ ef)), m: MutHashMap[k, v, r]): Unit \ ef + r
SourceApplies f
to each key-value pair in m
along with its index in insertion order.
Returns a new mutable hash map containing all key-value pairs from list l
.
If the list contains duplicate keys, the last occurrence wins.
Returns a new mutable hash map containing all key-value pairs from immutable map m
.
Returns Some(v)
if key k
exists in m
, otherwise None
.
Returns the value associated with key k
in m
.
If k
does not exist, inserts k
with value default
and returns default
.
Returns the value associated with key k
, or default
if not found.
def isEmpty(m: MutHashMap[k, v, r]): Bool \ r
SourceReturns true
if m
is empty.
def iterator(rc: Region[r2], m: MutHashMap[k, v, r]): Iterator[(k, v), r2 + r, r2] \ r + r2
SourceReturns an iterator over key-value pairs in m
in insertion order.
def iteratorKeys(rc: Region[r2], m: MutHashMap[k, v, r]): Iterator[k, r2 + r, r2] \ r + r2
SourceReturns an iterator over keys in m
in insertion order.
def iteratorValues(rc: Region[r2], m: MutHashMap[k, v, r]): Iterator[v, r2 + r, r2] \ r + r2
SourceReturns an iterator over values in m
in insertion order.
Returns a string formed by joining all keys in m
with sep
.
Returns a string formed by joining all values in m
with sep
.
def joinWith(f: k -> (v -> String \ ef), sep: String, m: MutHashMap[k, v, r]): String \ ef + r
SourceReturns a string formed by applying f
to each key-value pair and joining with sep
.
Returns the set of all keys in m
.
def last(m: MutHashMap[k, v, r]): Option[(k, v)] \ r
SourceReturns the last key-value pair that was inserted into the mutable map m
.
Returns None
if the map is empty.
def lastKey(m: MutHashMap[k, v, r]): Option[k] \ r
SourceReturns the last key that was inserted into the mutable map m
.
Returns None
if the map is empty.
def lastValue(m: MutHashMap[k, v, r]): Option[v] \ r
SourceReturns the last value that was inserted into the mutable map m
.
Returns None
if the map is empty.
def map(rc: Region[r2], f: v1 -> v2 \ ef, m: MutHashMap[k, v1, r1]): MutHashMap[k, v2, r2] \ ef + r1 + r2 with Eq[k], Hash[k]
SourceReturns a new mutable hash map with values transformed by function f
.
Keys and insertion order are preserved.
def mapWithKey(rc: Region[r2], f: k -> (v1 -> v2 \ ef), m: MutHashMap[k, v1, r1]): MutHashMap[k, v2, r2] \ ef + r1 + r2 with Eq[k], Hash[k]
SourceReturns a new mutable hash map with values transformed by function f
with access to keys.
Keys and insertion order are preserved.
Returns true
if key k
exists in m
.
def nonEmpty(m: MutHashMap[k, v, r]): Bool \ r
SourceReturns true
if m
is non-empty.
Inserts key k
with value v
into m
.
If the key already exists, updates its value (does not change insertion order).
def putWith(f: v -> (v -> v \ ef), k: k, v: v, m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceInserts key k
with value v
into m
, using combiner function f
if key exists.
If key exists with value oldV
, updates to f(v, oldV)
.
Otherwise, inserts k => v
.
def putWithKey(f: k -> (v -> (v -> v \ ef)), k: k, v: v, m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceInserts key k
with value v
into m
, using combiner function f
with key if key exists.
If key exists with value oldV
, updates to f(k, v, oldV)
.
Otherwise, inserts k => v
.
Removes all entries from m
where f(value)
returns false.
def refineWithKey(f: k -> (v -> Bool \ ef), m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceRemoves all entries from m
where f(key, value)
returns false.
Returns a mutable hash map with a single key-value pair k => v
.
def size(m: MutHashMap[k, v, r]): Int32 \ r
SourceReturns the number of entries in m
.
def toArray(rc: Region[r2], m: MutHashMap[k, v, r]): Array[(k, v), r2] \ r + r2
SourceReturns an array of all key-value pairs in m
in insertion order.
def toList(m: MutHashMap[k, v, r]): List[(k, v)] \ r
SourceReturns a list of all key-value pairs in m
in insertion order.
Returns an immutable map containing all key-value pairs from m
.
Returns a set containing all key-value pairs from m
.
Returns a string representation of m
.
def toVector(m: MutHashMap[k, v, r]): Vector[(k, v)] \ r
SourceReturns a vector of all key-value pairs in m
in insertion order.
def transform(f: v -> v \ ef, m: MutHashMap[k, v, r]): Unit \ ef + r
SourceTransforms all values in m
in-place using function f
.
def transformWithKey(f: k -> (v -> v \ ef), m: MutHashMap[k, v, r]): Unit \ ef + r
SourceTransforms all values in m
in-place using function f
with access to keys.
def update(f: v -> Option[v] \ ef, k: k, m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceUpdates or removes the value at key k
based on function f
.
If key exists and f(oldValue) = Some(newValue)
, updates to newValue.
If key exists and f(oldValue) = None
, removes the entry.
Does nothing if the key does not exist.
def updateWithKey(f: k -> (v -> Option[v] \ ef), k: k, m: MutHashMap[k, v, r]): Unit \ ef + r with Eq[k], Hash[k]
SourceUpdates or removes the value at key k
based on function f
with key.
If key exists and f(k, oldValue) = Some(newValue)
, updates to newValue.
If key exists and f(k, oldValue) = None
, removes the entry.
Does nothing if the key does not exist.
def valuesOf(m: MutHashMap[k, v, r]): List[v] \ r
SourceReturns a list of all values in m
in insertion order.