Skip to main content

class ProximityMapNonEmpty<K,V>

Concrete non-empty implementation of {@link ProximityMap.NonEmpty}.

It stores entries in a non-empty HashMap and applies the configured distance function when resolving lookups via {@link ProximityMapNonEmpty.get}.

Type parameters​

NameDescription
Kthe key type
Vthe value type

Properties​

_NonEmptyType​

undocumented

Definition​

_NonEmptyType: ProximityMap.NonEmpty<K, V>;

context​

undocumented

Definition​

readonly context: ProximityMap.Context<K>;

isEmpty​

undocumented

Definition​

readonly isEmpty = false;

size​

undocumented

Definition​

get size(): number;

Methods​

[Symbol.iterator]​

undocumented

Definition​

[Symbol.iterator](): FastIterator<readonly [K, V]>;

addEntries​

undocumented

Definition​

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

Parameters​

NameTypeDescription
entriesStreamSource<readonly [K, V]>

addEntry​

undocumented

Definition​

addEntry(entry: readonly [K, V]): ProximityMap.NonEmpty<K, V>;

Parameters​

NameTypeDescription
entryreadonly [K, V]

asNormal​

undocumented

Definition​

asNormal(): ProximityMap<K, V>;

assumeNonEmpty​

undocumented

Definition​

assumeNonEmpty(): this;

filter​

undocumented

Definition​

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

Parameters​

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

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;
  }

get​

undocumented

Definitions​

get<UK = K>(key: RelatedTo<K, UK>): V | undefined;

get<UK, O>(key: RelatedTo<K, UK>, otherwise: OptLazy<O>): V | O;

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keyRelatedTo<K, UK>

hasKey​

undocumented

Definition​

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

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keyRelatedTo<K, UK>

mapValues​

undocumented

Definition​

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

Type parameters​

NameDescription
V2

Parameters​

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

modifyAt​

undocumented

Definition​

modifyAt(atKey: K, options: {
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: <V2 extends V = V>(currentEntry: V & V2, remove: Token) => V | Token;
  }): ProximityMap<K, V>;

Parameters​

NameTypeDescription
atKeyK
options{
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: <V2 extends V = V>(currentEntry: V & V2, remove: Token) => V | Token;
  }

nonEmpty​

undocumented

Definition​

nonEmpty(): this is ProximityMap.NonEmpty<K, V>;

removeKey​

undocumented

Definition​

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

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keyRelatedTo<K, UK>

removeKeyAndGet​

undocumented

Definition​

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

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keyRelatedTo<K, UK>

removeKeys​

undocumented

Definition​

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

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keysStreamSource<RelatedTo<K, UK>>

set​

undocumented

Definition​

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

Parameters​

NameTypeDescription
keyK
valueV

stream​

undocumented

Definition​

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

streamKeys​

undocumented

Definition​

streamKeys(): Stream.NonEmpty<K>;

streamValues​

undocumented

Definition​

streamValues(): Stream.NonEmpty<V>;

toArray​

undocumented

Definition​

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

toBuilder​

undocumented

Definition​

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

toJSON​

undocumented

Definition​

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

toString​

undocumented

Definition​

toString(): string;

updateAt​

undocumented

Definition​

updateAt<UK = K>(key: RelatedTo<K, UK>, update: RMapBase.Update<V>): ProximityMap.NonEmpty<K, V>;

Type parameters​

NameDefaultDescription
UKK

Parameters​

NameTypeDescription
keyRelatedTo<K, UK>
updateRMapBase.Update<V>