Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/proximity/map-custom/index.ts>ProximityMapBuilder

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
class ProximityMapBuilder
implements [ProximityMap.Builder]<K, V>
Re-export
import { ProximityMapBuilder } from "https://deno.land/x/rimbu@1.0.0/proximity/map-custom/index.ts";

Constructors

new
ProximityMapBuilder(context: ProximityMap.Context<K>, source?: ProximityMap.NonEmpty<K, V>)

Properties

private
readonly
internalBuilder: HashMap.Builder<K, V>
addEntries: (entries: StreamSource<readonly [K, V]>) => boolean
addEntry: (entry: readonly [K, V]) => boolean
build: () => ProximityMap<K, V>
buildMapValues: <V2>(mapFun: (value: V, key: K) => V2) => ProximityMap<K, V2>
forEach: (f: (
entry: readonly [K, V],
index: number,
halt: () => void,
) => void
, state?: TraverseState | undefined
) => void
get: <UK, O>(key: RelatedTo<K, UK>, otherwise?: OptLazy<O>) => V | O

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

hasKey: <UK = K>(key: RelatedTo<K, UK>) => boolean
readonly
isEmpty: boolean
modifyAt: (key: K, options: { ifNew?: OptLazyOr<V, Token>; ifExists?: <V2 extends V = V>(currentValue: V & V2, remove: Token) => V | Token; }) => boolean
removeKey: <UK, O>(key: RelatedTo<K, UK>, otherwise?: OptLazy<O>) => V | O
removeKeys: <UK = K>(keys: StreamSource<RelatedTo<K, UK>>) => boolean
set: (key: K, value: V) => boolean
readonly
size: number
updateAt: <O>(
key: K,
update: RMapBase.Update<V>,
otherwise?: OptLazy<O>,
) => V | O