MultiMap
enum MultiMap[k: Type, v: Type]Sourcecase MultiMap(Map[k, Set[v]])The MultiMap type.
A MultiMap is a Map that allows multiple values for a key. Multiple values are stored in a Set so duplicates are not allowed.
The key and value types must implement the Eq and Order traits.
Instances
instance CommutativeMonoid[MultiMap[k, v]] with Order[k], Order[v]Sourceinstance CommutativeSemiGroup[MultiMap[k, v]] with Order[k], Order[v]Sourceinstance UnorderedFoldable[MultiMap[k]]SourceDefinitions
def adjust(f: v -> v \ ef, k: k, m: MultiMap[k, v]): MultiMap[k, v] \ ef with Order[k], Order[v]
 SourceUpdates m with k => map(f, vs) if k => vs is in m.
Otherwise, returns m.
def adjustWithKey(f: k -> (v -> v \ ef), k: k, m: MultiMap[k, v]): MultiMap[k, v] \ ef with Order[k], Order[v]
 SourceUpdates m with k => map(f(k), vs) if k => vs is in m. Otherwise, returns m.
@ParallelWhenPure def count(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Int32 \ ef
 SourceReturns the number of mappings k => v in m that satisfy the predicate f.
Purity reflective: Runs in parallel when given a pure function f.
def difference(m1: MultiMap[k, v], m2: MultiMap[k, v]): MultiMap[k, v] with Order[k], Order[v]
 SourceReturns the difference of m1 and m2 i.e m1 - m2 (left biased).
def empty(): MultiMap[k, v]
 SourceReturns the empty MultiMap.
def exists(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Bool \ ef
 SourceReturns true if and only if at least one mapping in m satisfies the predicate f.
Returns false if m is the empty MultiMap.
def filter(f: v -> Bool \ ef, m: MultiMap[k, v]): MultiMap[k, v] \ ef with Order[k], Order[v]
 SourceReturns a MultiMap of all mappings k => v in m where v satisfies the predicate f.
def filterWithKey(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): MultiMap[k, v] \ ef with Order[k], Order[v]
 SourceReturns a MultiMap of all mappings k => v in m where (k, v) satisfies the predicate f.
def find(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Option[(k, v)] \ ef
 SourceAlias for findLeft.
def findLeft(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Option[(k, v)] \ ef
 SourceOptionally returns the first mapping of m that satisfies the predicate f when searching from left to right.
def findRight(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Option[(k, v)] \ ef
 SourceOptionally returns the first mapping of m that satisfies the predicate f when searching from right to left.
def foldLeft(f: b -> (v -> b \ ef), s: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value s and all values in m going from left to right.
That is, the result is of the form: f(...f(f(s, v1), v2)..., vn).
def foldLeftWithKey(f: b -> (k -> (v -> b \ ef)), s: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value s and all key-value pairs in m going from left to right.
That is, the result is of the form: f(...f(f(s, k1, v1), k2, v2)..., vn).
Returns the result of mapping each value and combining the results.
Returns the result of mapping each key-value pair and combining the results.
def foldRight(f: v -> (b -> b \ ef), s: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value s and all values in m going from right to left.
That is, the result is of the form: f(v1, ...f(vn-1, f(vn, s))).
def foldRightWithCont(f: v -> ((Unit -> b \ ef) -> b \ ef), z: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value z and all values in m going from right to left.
That is, the result is of the form: f(v1, ...f(vn-1, f(vn, z))).
A foldRightWithCont allows early termination by not calling the continuation.
def foldRightWithKey(f: k -> (v -> (b -> b \ ef)), s: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value s and all key-value pairs in m going from right to left.
That is, the result is of the form: f(k1, v1, ...f(kn-1, vn-1, f(kn, vn, s))).
def foldRightWithKeyCont(f: k -> (v -> ((Unit -> b \ ef) -> b \ ef)), z: b, m: MultiMap[k, v]): b \ ef
 SourceApplies f to a start value z and all key-value pairs in m going from right to left.
That is, the result is of the form: f(k1, v1, ...f(kn-1, vn-1, f(kn, vn, z))).
A foldRightWithKeyCont allows early termination by not calling the continuation.
def foldWithKey(f: b -> (k -> (v -> b \ ef)), s: b, m: MultiMap[k, v]): b \ ef
 SourceAlias for foldLeftWithKey.
def forAll(f: k -> (v -> Bool \ ef), m: MultiMap[k, v]): Bool \ ef
 SourceReturns true if and only if all mappings in m satisfy the predicate f.
Returns true if m is the empty MultiMap.
def forEach(f: k -> (v -> Unit \ ef), m: MultiMap[k, v]): Unit \ ef
 SourceApplies f to every (key, value) of MultiMap m.
def forEachWithIndex(f: Int32 -> (k -> (v -> Unit \ ef)), m: MultiMap[k, v]): Unit \ ef
 SourceApplies f to tuple (index, key, value) formed of the keys and values of
MultiMap m and the index of the traversal.
Returns Some(vs) if k => vs is in m.
Otherwise returns Set.empty().
Updates m with k => Set.union(v, v0) if k => v0 is in m.
Otherwise, returns m with k => Set.singleton(v).
def insertAll(k: k, vs: t[v], m: MultiMap[k, v]): MultiMap[k, v] \ Aef[t] with Order[k], Order[v], Foldable[t]
 SourceUpdates m with k => vs.
Where vs is any foldable container. If vs is empty nothing is inserted.
def intersection(m1: MultiMap[k, v], m2: MultiMap[k, v]): MultiMap[k, v] with Order[k], Order[v]
 SourceReturns the intersection of m1 and m2.
def isEmpty(m: MultiMap[k, v]): Bool
 SourceReturns true if and only if m is the empty MultiMap.
def iterator(rc: Region[r], m: MultiMap[k, v]): Iterator[(k, Set[v]), r, r] \ r
 SourceReturns an iterator over all key-value pairs in m i.e. k => Set#{v_1, ..., v_n}.
@ParallelWhenPure Returns a MultiMap with mappings k => f(v) for every k => v in m.
Purity reflective: Runs in parallel when given a pure function f.
@ParallelWhenPure def mapWithKey(f: k -> (v1 -> v2 \ ef), m: MultiMap[k, v1]): MultiMap[k, v2] \ ef with Order[v2]
 SourceReturns a MultiMap with mappings k => f(k, v) for every k => v in m.
Purity reflective: Runs in parallel when given a pure function f.
Returns true if and only if m contains the key k.
def nonEmpty(m: MultiMap[k, v]): Bool
 SourceReturns true if and only if m is a non-empty MultiMap.
def reduceLeft(f: v -> (v -> v \ ef), m: MultiMap[k, v]): Option[v] \ ef
 SourceApplies f to all values in m going from left to right until a single value v is obtained. Returns Some(v).
That is, the result is of the form: Some(f(...f(f(v1, v2), v3)..., vn))
Returns None if m is the empty MultiMap.
def reduceLeftWithKey(f: k -> (v -> (k -> (v -> (k, v) \ ef))), m: MultiMap[k, v]): Option[(k, v)] \ ef
 SourceApplies f to all mappings in m going from left to right until a single mapping (k, v) is obtained. Returns Some((k, v)).
That is, the result is of the form: Some(f(...f(f(k1, v1, k2, v2), k3, v3)..., kn, vn))
Returns None if m is the empty MultiMap.
def reduceRight(f: v -> (v -> v \ ef), m: MultiMap[k, v]): Option[v] \ ef
 SourceApplies f to all values in m going from right to left until a single value v is obtained. Returns Some(v).
That is, the result is of the form: Some(f(v1, ...f(vn-2, f(vn-1, vn))...))
Returns None if m is the empty MultiMap.
def reduceRightWithKey(f: k -> (v -> (k -> (v -> (k, v) \ ef))), m: MultiMap[k, v]): Option[(k, v)] \ ef
 SourceApplies f to all mappings in m going from right to left until a single mapping (k, v) is obtained. Returns Some((k, v)).
That is, the result is of the form: Some(f(k1, v1, ...f(kn-2, vn-2, f(kn-1, vn-1, kn, vn))...))
Returns None if m is the empty MultiMap.
Removes the mapping k from the MultiMap m.
Removes the mapping of (k, v) from the MultiMap m it it exists.
Returns the singleton MultiMap where key k is mapped to value v.
def size(m: MultiMap[k, v]): Int32
 SourceReturns the number of keys in m.
def toAscList(m: MultiMap[k, v]): List[(k, v)]
 SourceReturns the MultiMap m as a list of singleton key-value pairs in ascending order.
def toAssocList(m: MultiMap[k, v]): List[(k, Set[v])]
 SourceReturns the MultiMap m as a list of (key, Set[value]) pairs in ascending order.
def toDescList(m: MultiMap[k, v]): List[(k, v)]
 SourceReturns the MultiMap m as a list of singleton key-value pairs in descending order.
def toList(m: MultiMap[k, v]): List[(k, v)]
 SourceReturns the MultiMap m as a list of singleton key-value pairs.
def toMap(m: MultiMap[k, v]): Map[k, Set[v]]
 SourceReturns the MultiMap m as a list of singleton key-value pairs in ascending order.
Returns a string representation of m.
Returns the union of m1 and m2.
def update(f: v -> Option[v] \ ef, k: k, m: MultiMap[k, v]): MultiMap[k, v] \ ef with Order[k], Order[v]
 SourceUpdates m with k => v1 if k => v is in m and f(v) = Some(v1). Otherwise, returns m.