Skip to main content

interface ProximityMap.NonEmpty<K,V>

A non-empty type-invariant immutable Map of key type K, and value type V. In the Map, each key has exactly one value, and the Map cannot contain duplicate keys. See the Map documentation and the ProximityMap API documentation

Type parameters

NameDescription
Kthe key type
Vthe value type
note

The get() method is designed to perform a linear scan of all the keys, returning the value associated with the key having the least distance from the input key; however, optimized distance functions can greatly improve efficiency by preventing a full scan.

example
const m1 = ProximityMap.empty<number, string>()
const m2 = ProximityMap.of([1, 'a'], [2, 'b'])

Methods

stream

undocumented

Definition

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