MultiMap
Ordered binary tree that holds multiple values with the same key
Operations
Each
Function called for each element
method : public : Each(f:(K,V)~Nil) ~ MultiMap<K,V>Parameters
| Name | Type | Description |
|---|---|---|
| f | (K,V)~Nil | function called |
Filter
Uses the given function to filter out values
method : public : Filter(f:(K)~Bool) ~ MultiMap<K,V>Parameters
| Name | Type | Description |
|---|---|---|
| f | (K)~Bool | function to use a filter. If the function evaluates to true the value is added to the collection. |
Return
| Type | Description |
|---|---|
| MultiMap<K,V> | filter vector |
Find
Checks for a value in a map
method : public : Find(key:K) ~ Vector<V>Parameters
| Name | Type | Description |
|---|---|---|
| key | K | search key |
Return
| Type | Description |
|---|---|
| Vector<V> | true if found, false otherwise |
GetKeys
Get a collection of keys
method : public : GetKeys() ~ Vector<K>Return
| Type | Description |
|---|---|
| Vector<K> | vector of keys |
GetValues
Gets a collection of values
method : public : GetValues() ~ Vector<V>Return
| Type | Description |
|---|---|
| Vector<V> | vector of values |
Has
Checks for a value in a map
method : public : Has(key:K) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | K | search key |
Return
| Type | Description |
|---|---|
| Bool | true if found, false otherwise |
Insert
Inserts a value into the map
method : public : Insert(key:K, value:V) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| key | K | key |
| value | V | value |
IsEmpty
Checks to see if the map is empty
method : public : IsEmpty() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if empty, false otherwise |
Reduce
Uses the given function to reduce the values
method : public : Reduce(a:K, f:(K,K)~K) ~ KParameters
| Name | Type | Description |
|---|---|---|
| a | K | initial value (i.e. accumulator) |
| f | (K,K)~K | function to use a reduce |
Return
| Type | Description |
|---|---|
| K | reduced vector |
Remove
Removes a set of values from the map
method : public : Remove(key:K) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | K | key for values to remove |
ToString
Formats the collection into a string. If an element implements the 'Stringify' interface, it's 'ToString()' is called.
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation |