Skip to main content

class HashMapCollision<K,V>

undocumented

Extends: HashMapNonEmptyBase<K,V>

Type parameters

NameDescription
Kundocumented
Vundocumented

Properties

context

undocumented

Definition

readonly context: HashMapContext<K>;

Overrides

HashMapNonEmptyBase.context

entries

undocumented

Definition

readonly entries: List.NonEmpty<readonly [K, V]>;

isEmpty

undocumented

Definition

get isEmpty(): false;

Overrides

NonEmptyBase.isEmpty

size

undocumented

Definition

get size(): number;

Overrides

HashMapNonEmptyBase.size

Methods

[Symbol.iterator]

undocumented

Definition

[Symbol.iterator](): FastIterator<E>;

Overrides

NonEmptyBase.[Symbol.iterator]

addEntries

Returns the collection with the entries from the given StreamSource entries added.

Definition

addEntries(entries: StreamSource<readonly [K, V]>): HashMap.NonEmpty<K, V>;

Parameters

NameTypeDescription
entriesStreamSource<readonly [K, V]>
example
HashMap.of([1, 'a']).addEntries([[2, 'b']]).toArray()   // => [[1, 'a'], [2, 'b']]

Overrides

NonEmpty.addEntries, HashMapNonEmptyBase.addEntries

addEntry

undocumented

Definition

addEntry(entry: readonly [K, V], hash?: number): HashMapCollision<K, V>;

Parameters

NameTypeDescription
entryreadonly [K, V]
hashnumber

Overrides

HashMapNonEmptyBase.addEntry

asNormal

undocumented

Definition

asNormal(): this;

Overrides

NonEmptyBase.asNormal, HashMapNonEmptyBase.asNormal

assumeNonEmpty

undocumented

Definition

assumeNonEmpty(): this;

Overrides

NonEmptyBase.assumeNonEmpty

copy

undocumented

Definition

copy(entries?: List.NonEmpty<readonly [K, V]>): HashMapCollision<K, V>;

Parameters

NameTypeDescription
entriesList.NonEmpty<readonly [K, V]>

filter

undocumented

Definition

filter(pred: (entry: readonly [K, V], index: number, halt: () => void) => boolean, options?: {
    negate?: boolean;
  }): HashMap<K, V>;

Parameters

NameTypeDescription
pred(entry: readonly [K, V], index: number, halt: () => void) => boolean
options{
    negate?: boolean;
  }

Overrides

HashMapNonEmptyBase.filter

forEach

undocumented

Definition

forEach(f: (entry: readonly [K, V], index: number, halt: () => void) => void, options?: {
    state?: TraverseState;
  }): void;

Parameters

NameTypeDescription
f(entry: readonly [K, V], index: number, halt: () => void) => void
options{
    state?: TraverseState;
  }

Overrides

HashMapNonEmptyBase.forEach

get

undocumented

Definition

get<U, O>(key: RelatedTo<K, U>, otherwise?: OptLazy<O>, keyHash?: number): V | O;

Type parameters

NameDescription
U
O

Parameters

NameTypeDescription
keyRelatedTo<K, U>
otherwiseOptLazy<O>
keyHashnumber

Overrides

HashMapNonEmptyBase.get

hasKey

undocumented

Definition

hasKey<U>(key: RelatedTo<K, U>): boolean;

Type parameters

NameDescription
U

Parameters

NameTypeDescription
keyRelatedTo<K, U>

Overrides

HashMapNonEmptyBase.hasKey

mapValues

undocumented

Definition

mapValues<V2>(mapFun: (value: V, key: K) => V2): HashMap.NonEmpty<K, V2>;

Type parameters

NameDescription
V2

Parameters

NameTypeDescription
mapFun(value: V, key: K) => V2

Overrides

HashMapNonEmptyBase.mapValues

modifyAt

undocumented

Definition

modifyAt(atKey: K, options: {
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentValue: V, remove: Token) => V |Token)| V;
  }, atKeyHash?: number): HashMap<K, V> | any;

Parameters

NameTypeDescription
atKeyK
options{
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentValue: V, remove: Token) => V |Token)| V;
  }
atKeyHashnumber

Overrides

HashMapNonEmptyBase.modifyAt

nonEmpty

undocumented

Definition

nonEmpty(): true;

Overrides

NonEmptyBase.nonEmpty

removeKey

undocumented

Definition

removeKey<UK>(key: RelatedTo<K, UK>): HashMap<K, V>;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>

Overrides

HashMapNonEmptyBase.removeKey

removeKeyAndGet

undocumented

Definition

removeKeyAndGet<UK>(key: RelatedTo<K, UK>): [HashMap<K, V>, V] | undefined;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>

Overrides

HashMapNonEmptyBase.removeKeyAndGet

removeKeys

undocumented

Definition

removeKeys<UK>(keys: StreamSource<RelatedTo<K, UK>>): HashMap<K, V>;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keysStreamSource<RelatedTo<K, UK>>

Overrides

HashMapNonEmptyBase.removeKeys

set

Returns the collection with the given key associated to the given value.

Definition

set(key: K, value: V): HashMap.NonEmpty<K, V>;

Parameters

NameTypeDescription
keyK
valueV
example
HashMap.of([1, 'a']).set(2, 'b').toArray()   // => [[1, 'a'], [2, 'b']]
HashMap.of([1, 'a']).set(1, 'b').toArray() // => [[1, 'b']]
note

if the key is already associated, the previous value will be 'replaced'

Overrides

RMapBase.set, HashMapNonEmptyBase.set

stream

undocumented

Definition

stream(): Stream.NonEmpty<readonly [K, V]>;

Overrides

NonEmptyBase.stream

streamKeys

undocumented

Definition

streamKeys(): Stream.NonEmpty<K>;

Overrides

HashMapNonEmptyBase.streamKeys

streamValues

undocumented

Definition

streamValues(): Stream.NonEmpty<V>;

Overrides

HashMapNonEmptyBase.streamValues

toArray

undocumented

Definition

toArray(): ArrayNonEmpty<readonly [K, V]>;

Overrides

HashMapNonEmptyBase.toArray

toBuilder

Returns a builder object containing the entries of this collection.

Definition

toBuilder(): HashMap.Builder<K, V>;

example
const builder: HashMap.Builder<number, string> = HashMap.of([1, 'a'], [2, 'b']).toBuilder()

Overrides

RMapBase.toBuilder, HashMapNonEmptyBase.toBuilder

toJSON

undocumented

Definition

toJSON(): ToJSON<(readonly [K, V])[]>;

Overrides

HashMapNonEmptyBase.toJSON

toString

undocumented

Definition

toString(): string;

Overrides

HashMapNonEmptyBase.toString

updateAt

Returns the collection where the value associated with given 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

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>
updateUpdate<V>
example
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]]

Overrides

NonEmpty.updateAt, HashMapNonEmptyBase.updateAt