class BiMultiMapBuilder<K,V,Tp,TpG>
undocumented
Implements: BiMultiMapBase.Builder<K,V,Tp>
Type parameters
Name | Constraints | Default | Description |
---|---|---|---|
K | undocumented | ||
V | undocumented | ||
Tp | ContextTypesImpl | undocumented | |
TpG | WithKeyValue <Tp, K, V> | WithKeyValue <Tp, K, V> | undocumented |
Properties
_keyValueMultiMap
undocumented
_keyValueMultiMap
Definition
_keyValueMultiMap?:
MultiMap.Builder
<K, V>;
_valueKeyMultiMap
undocumented
_valueKeyMultiMap
Definition
_valueKeyMultiMap?:
MultiMap.Builder
<V, K>;
addEntries
undocumented
addEntries
Definition
addEntries: (entries:
StreamSource
<readonly [K, V]>) => boolean;
build
undocumented
build
Definition
build: () =>
WithKeyValue
<Tp, K, V>["normal"];
forEach
undocumented
forEach
Definition
forEach: (f: (entry: [K, V], index: number, halt: () => void) => void, options?: {
state?:
TraverseState
;
}) => void;
getKeys
undocumented
getKeys
Definition
getKeys: <UV = V>(value:
RelatedTo
<V, UV>) =>
WithKeyValue
<Tp, K, V>["valueMultiMapValues"];
getValues
undocumented
getValues
Definition
getValues: <UK = K>(key:
RelatedTo
<K, UK>) =>
WithKeyValue
<Tp, K, V>["keyMultiMapValues"];
hasEntry
undocumented
hasEntry
isEmpty
undocumented
isEmpty
keyValueMultiMap
undocumented
keyValueMultiMap
Definition
get keyValueMultiMap():
MultiMap.Builder
<K, V>;
removeEntries
undocumented
removeEntries
Definition
removeEntries: <UK = K, UV = V>(entries:
StreamSource
<[
RelatedTo
<K, UK>,
RelatedTo
<V, UV>]>) => boolean;
removeEntry
undocumented
removeEntry
removeKeys
undocumented
removeKeys
Definition
removeKeys: <UK = K>(keys:
StreamSource
<
RelatedTo
<K, UK>>) => boolean;
removeValues
undocumented
removeValues
Definition
removeValues: <UV = V>(values:
StreamSource
<
RelatedTo
<V, UV>>) => boolean;
setKeys
undocumented
setKeys
Definition
setKeys: (value: V, keys:
StreamSource
<K>) => boolean;
setValues
undocumented
setValues
Definition
setValues: (key: K, values:
StreamSource
<V>) => boolean;
size
undocumented
size
valueKeyMultiMap
undocumented
valueKeyMultiMap
Definition
get valueKeyMultiMap():
MultiMap.Builder
<V, K>;
Methods
add
Associates given key
with given value
in the builder.
add
key
with given value
in the builder.addEntries
Adds given entries
to the builder.
addEntries
entries
to the builder.Definition
addEntries(entries:
StreamSource
<readonly [K, V]>): boolean;
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <readonly [K, V]> |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.addEntries([1, 'a'], [3, 'c']]) // => true
m.addEntries([]) // => false
Overrides
build
Returns an immutable collection instance containing the entries in this builder.
build
Definition
build():
WithKeyValue
<Tp, K, V>['normal'];
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
const m2: HashBiMultiMap<number, string> = m.build()
Overrides
forEach
Performs given function f
for each entry of the builder.
forEach
f
for each entry of the builder.Definition
forEach(f: (entry: [K, V], index: number, halt: () => void) => void, options?: {
state?:
TraverseState
;
}): void;
Parameters
Name | Type | Description |
---|---|---|
f | (entry: [K, V], index: number, halt: () => void) => void | the function to perform for each element, receiving: - entry : the next key-value entry- index : the index of the element- halt : a function that, if called, ensures that no new elements are passed |
options | { state?: TraverseState ; } |
RibuError.ModifiedBuilderWhileLoopingOverItError if the builder is modified while looping over it
HashBiMultiMap.of([1, 'a'], [2, 'b'], [3, 'c']).toBuilder().forEach((entry, i, halt) => {
console.log([entry[1], entry[0]]);
if (i >= 1) halt();
})
// => logs ['a', 1] ['b', 2]
O(N)
Overrides
getKeys
Returns a collection representing the keys currently associated with given value
.
getKeys
value
.Definition
getKeys<UV = V>(value:
RelatedTo
<V, UV>):
WithKeyValue
<Tp, K, V>['valueMultiMapValues'];
Type parameters
Name | Default | Description |
---|---|---|
UV | V |
Parameters
Name | Type | Description |
---|---|---|
value | RelatedTo <V, UV> | the value for which to find the keys |
since it is unsafe to return the internal builder object, the result colleciton will be build upon each call to getKeys.
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.getKeys('a').toArray() // => [1]
m.getKeys('z').toArray() // => []
Overrides
getValues
Returns a collection representing the values currently associated with given key
.
getValues
key
.Definition
getValues<UK = K>(key:
RelatedTo
<K, UK>):
WithKeyValue
<Tp, K, V>['keyMultiMapValues'];
Type parameters
Name | Default | Description |
---|---|---|
UK | K |
Parameters
Name | Type | Description |
---|---|---|
key | RelatedTo <K, UK> | the key for which to find the values |
since it is unsafe to return the internal builder object, the result colleciton will be build upon each call to getValues.
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.getValues(1).toArray() // => ['a']
m.getValues(3).toArray() // => []
Overrides
hasEntry
Returns true if the given key
value
entry is present in the builder.
hasEntry
key
value
entry is present in the builder.Definition
hasEntry<UK = K, UV = V>(key:
RelatedTo
<K, UK>, value:
RelatedTo
<V, UV>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UK | K | |
UV | V |
Parameters
Name | Type | Description |
---|---|---|
key | RelatedTo <K, UK> | the key to look for |
value | RelatedTo <V, UV> | the value to look for |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.hasEntry(1, 'a') // => true
m.hasEntry(1, 'z') // => false
Overrides
hasKey
Returns true if the given key
is present in the builder.
hasKey
key
is present in the builder.hasValue
Returns true if the given value
is present in the builder.
hasValue
value
is present in the builder.Definition
hasValue<UV = V>(value:
RelatedTo
<V, UV>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UV | V |
Parameters
Name | Type | Description |
---|---|---|
value | RelatedTo <V, UV> | the value to look for |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.hasValue('a') // => true
m.hasValue('z') // => false
Overrides
removeEntries
Removes the entries in the given entries
StreamSource
from the builder.
removeEntries
entries
StreamSource
from the builder.Definition
removeEntries<UK = K, UV = V>(entries:
StreamSource
<[
RelatedTo
<K, UK>,
RelatedTo
<V, UV>]>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UK | K | |
UV | V |
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <[ RelatedTo <K, UK>, RelatedTo <V, UV>]> |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.removeEntries([[1, 'c'], ['2', 'a']]) // => false
m.removeEntries([[1, 'a']]) // => true
Overrides
removeEntry
Removes the entry of given key
and value
from the builder.
removeEntry
key
and value
from the builder.Definition
removeEntry<UK = K, UV = V>(key:
RelatedTo
<K, UK>, value:
RelatedTo
<V, UV>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UK | K | |
UV | V |
Parameters
Name | Type | Description |
---|---|---|
key | RelatedTo <K, UK> | the entry key |
value | RelatedTo <V, UV> |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.removeEntry(1, 'c') // => false
m.removeEntry(1, 'a') // => true
Overrides
removeKey
Removes the entries related to given key
from the builder.
removeKey
key
from the builder.removeKeys
Removes the entries related to the given keys
StreamSource
from the builder.
removeKeys
keys
StreamSource
from the builder.Definition
removeKeys<UK = K>(keys:
StreamSource
<
RelatedTo
<K, UK>>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UK | K |
Parameters
Name | Type | Description |
---|---|---|
keys | StreamSource < RelatedTo <K, UK>> |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.removeKeys([3, 4, 5]) // => false
m.removeKeys([1, 10]) // => true
Overrides
removeValue
Removes the entries related to given value
from the builder.
removeValue
value
from the builder.removeValues
Removes the entries related to the given values
StreamSource
from the builder.
removeValues
values
StreamSource
from the builder.Definition
removeValues<UV = V>(values:
StreamSource
<
RelatedTo
<V, UV>>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UV | V |
Parameters
Name | Type | Description |
---|---|---|
values | StreamSource < RelatedTo <V, UV>> |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.removeValues(['c', 'd', 'e']) // => false
m.removeValues(['a', 'e']) // => true
Overrides
setKeys
Sets the keys associated to given value
to the keys in the given keys
StreamSource.
setKeys
value
to the keys in the given keys
StreamSource.Definition
setKeys(value: V, keys:
StreamSource
<K>): boolean;
Parameters
Name | Type | Description |
---|---|---|
value | V | the value to which to associate the keys |
keys | StreamSource <K> | a StreamSource containing the keys to associate to the value |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.setKeys('a', [3, 4]).getKeys('a').toArray() // => [3, 4]
Overrides
setValues
Sets the values associated to given key
to the values in the given values
StreamSource.
setValues
key
to the values in the given values
StreamSource.Definition
setValues(key: K, values:
StreamSource
<V>): boolean;
Parameters
Name | Type | Description |
---|---|---|
key | K | the key to which to associate the values |
values | StreamSource <V> | a StreamSource containing the values to associate to the key |
const m = HashBiMultiMap.of([1, 'a'], [2, 'b']).toBuilder()
m.setValues(1, ['b', 'c']).getValues(1).toArray() // => ['b', 'c']