class HashMapCollision<K,V>
undocumented
Extends: HashMapNonEmptyBase<K,V>
Type parameters
Name | Description |
---|---|
K | undocumented |
V | undocumented |
Properties
_NonEmptyType
undocumented
_NonEmptyType
context
undocumented
context
entries
undocumented
entries
Definition
readonly entries:
List.NonEmpty
<readonly [K, V]>;
isEmpty
undocumented
isEmpty
size
undocumented
size
Methods
[Symbol.iterator]
undocumented
[Symbol.iterator]
addEntries
Returns the collection with the entries from the given StreamSource
entries
added.
addEntries
StreamSource
entries
added.Definition
addEntries(entries:
StreamSource
<readonly [K, V]>):
HashMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <readonly [K, V]> |
HashMap.of([1, 'a']).addEntries([[2, 'b']]).toArray() // => [[1, 'a'], [2, 'b']]
Overrides
addEntry
undocumented
addEntry
Definition
addEntry(entry: readonly [K, V], hash?: number):
HashMapCollision
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entry | readonly [K, V] | |
hash | number |
Overrides
asNormal
undocumented
asNormal
assumeNonEmpty
undocumented
assumeNonEmpty
copy
undocumented
copy
Definition
copy(entries?:
List.NonEmpty
<readonly [K, V]>):
HashMapCollision
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entries | List.NonEmpty <readonly [K, V]> |
filter
undocumented
filter
forEach
undocumented
forEach
Definition
forEach(f: (entry: readonly [K, V], index: number, halt: () => void) => void, options?: {
state?:
TraverseState
;
}): void;
Parameters
Name | Type | Description |
---|---|---|
f | (entry: readonly [K, V], index: number, halt: () => void) => void | |
options | { state?: TraverseState ; } |
Overrides
get
undocumented
get
hasKey
undocumented
hasKey
mapValues
undocumented
mapValues
Definition
mapValues<V2>(mapFun: (value: V, key: K) => V2):
HashMap.NonEmpty
<K, V2>;
Type parameters
Name | Description |
---|---|
V2 |
Parameters
Name | Type | Description |
---|---|---|
mapFun | (value: V, key: K) => V2 |
Overrides
modifyAt
undocumented
modifyAt
Definition
modifyAt(atKey: K, options: {
ifNew?:
OptLazyOr
<V, Token>;
ifExists?: ((currentValue: V, remove: Token) => V
|
Token)
|
V;
}, atKeyHash?: number):
HashMap
<K, V>
|
any;
Parameters
Name | Type | Description |
---|---|---|
atKey | K | |
options | { ifNew?: OptLazyOr <V, Token>; ifExists?: ((currentValue: V, remove: Token) => V | Token) | V; } | |
atKeyHash | number |
Overrides
nonEmpty
undocumented
nonEmpty
removeKey
undocumented
removeKey
removeKeyAndGet
undocumented
removeKeyAndGet
removeKeys
undocumented
removeKeys
Definition
removeKeys<UK>(keys:
StreamSource
<
RelatedTo
<K, UK>>):
HashMap
<K, V>;
Type parameters
Name | Description |
---|---|
UK |
Parameters
Name | Type | Description |
---|---|---|
keys | StreamSource < RelatedTo <K, UK>> |
Overrides
set
Returns the collection with the given key
associated to the given value
.
set
key
associated to the given value
.Definition
set(key: K, value: V):
HashMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
key | K | |
value | V |
HashMap.of([1, 'a']).set(2, 'b').toArray() // => [[1, 'a'], [2, 'b']]
HashMap.of([1, 'a']).set(1, 'b').toArray() // => [[1, 'b']]
if the key is already associated, the previous value will be 'replaced'
Overrides
stream
undocumented
stream
streamKeys
undocumented
streamKeys
streamValues
undocumented
streamValues
toArray
undocumented
toArray
toBuilder
Returns a builder object containing the entries of this collection.
toBuilder
Definition
toBuilder():
HashMap.Builder
<K, V>;
const builder: HashMap.Builder<number, string> = HashMap.of([1, 'a'], [2, 'b']).toBuilder()
Overrides
toJSON
undocumented
toJSON
toString
undocumented
toString
updateAt
Returns the collection where the value associated with given key
is updated with the given update
value or update function.
updateAt
key
is updated with the given update
value or update function.Definition
updateAt<UK>(key:
RelatedTo
<K, UK>, update:
Update
<V>):
HashMap.NonEmpty
<K, V>;
Type parameters
Name | Description |
---|---|
UK |
Parameters
Name | Type | Description |
---|---|---|
key | RelatedTo <K, UK> | |
update | Update <V> |
const m = HashMap.of([1, 'a'], [2, 'b'])
m.updateAt(3, 'a').toArray()
// => [[1, 'a'], [2, 'b']]
m.updateAt(2, 'c').toArray()
// => [[1, 'a'], [2, 'c']]
m.updateAt(2, v => v + 'z')
// => [[1, 'a'], [2, 'cz]]