@rimbu/proximity
Version:
Immutable ProximityMap implementation for TypeScript
38 lines (37 loc) • 1.56 kB
text/typescript
import { Token } from '@rimbu/base';
import { EmptyBase } from '@rimbu/collection-types/map-custom';
import { OptLazy, OptLazyOr, type ToJSON } from '@rimbu/common';
import { Stream, type StreamSource } from '@rimbu/stream';
import type { ProximityMap } from '@rimbu/proximity/map';
/**
* Concrete empty implementation of {@link ProximityMap}.<br/>
* <br/>
* It represents an empty `ProximityMap` instance for a given context and efficiently
* creates non-empty maps when elements are added.
*
* @typeparam K - the key type
* @typeparam V - the value type
*/
export declare class ProximityMapEmpty<K = any, V = any> extends EmptyBase implements ProximityMap<K, V> {
readonly context: ProximityMap.Context<K>;
_NonEmptyType: ProximityMap.NonEmpty<K, V>;
constructor(context: ProximityMap.Context<K>);
streamKeys(): Stream<K>;
streamValues(): Stream<V>;
get<O>(_key: K, otherwise?: OptLazy<O>): O;
hasKey(): false;
set(key: K, value: V): ProximityMap.NonEmpty<K, V>;
addEntry(entry: readonly [K, V]): ProximityMap.NonEmpty<K, V>;
addEntries(entries: StreamSource<readonly [K, V]>): ProximityMap.NonEmpty<K, V>;
removeKeyAndGet(): undefined;
removeKey(): ProximityMap<K, V>;
removeKeys(): ProximityMap<K, V>;
modifyAt(atKey: K, options: {
ifNew?: OptLazyOr<V, Token>;
}): ProximityMap<K, V>;
mapValues<V2>(): ProximityMap<K, V2>;
updateAt(): ProximityMap<K, V>;
toBuilder(): ProximityMap.Builder<K, V>;
toString(): string;
toJSON(): ToJSON<(readonly [K, V])[]>;
}