Skip to main content

class ProximityMapBuilder<K,V>

Mutable builder used to efficiently construct new immutable {@link ProximityMap} instances.

The builder stores entries in an internal HashMap.Builder and only wraps the result into a ProximityMap when {@link ProximityMapBuilder.build | build} (or {@link ProximityMapBuilder.buildMapValues | buildMapValues}) is called.

Type parameters​

NameDescription
Kthe key type
Vthe value type

Properties​

addEntries​

undocumented

Definition​

addEntries: (entries: StreamSource<readonly [K, V]>) => boolean;

addEntry​

undocumented

Definition​

addEntry: (entry: readonly [K, V]) => boolean;

build​

undocumented

Definition​

build: () => ProximityMap<K, V>;

buildMapValues​

undocumented

Definition​

buildMapValues: <V2>(mapFun: (value: V, key: K) => V2) => ProximityMap<K, V2>;

context​

undocumented

Definition​

readonly context: ProximityMap.Context<K>;

forEach​

undocumented

Definition​

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

get​

Applying get() to the Builder does NOT apply the proximity algorithm - which would be pointless at this construction stage; the internal, hash-based builder is queried instead

Definition​

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

hasKey​

undocumented

Definition​

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

isEmpty​

undocumented

Definition​

get isEmpty(): boolean;

modifyAt​

undocumented

Definition​

modifyAt: (key: K, options: {
    ifNew?: OptLazyOr<V, typeof Token>;
    ifExists?: (<V2 extends V = V>(currentValue: V & V2, remove: typeof Token) => V |typeof Token)| V;
  }) => boolean;

removeKey​

undocumented

Definition​

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

removeKeys​

undocumented

Definition​

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

set​

undocumented

Definition​

set: (key: K, value: V) => boolean;

size​

undocumented

Definition​

get size(): number;

updateAt​

undocumented

Definition​

updateAt: <O>(key: K, update: RMapBase.Update<V>, otherwise?: OptLazy<O>) => V | O;