Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HashMap<K, V>

Configurable hash map implementation w/ ES6 Map API. Uses open addressing / linear probing to resolve key collisions. Supports any key types via mandatory user supplied hash function.

See HashMapOpts for further configuration & behavior details.

example
import { HashMap } from "@thi.ng/associative"
import { hash } from "@thi.ng/vectors"

m = new HashMap([], { hash })
m.set([1, 2], "a");
m.set([3, 4], "b");
m.set([1, 2], "c");
// HashMap { [ 1, 2 ] => 'c', [ 3, 4 ] => 'b' }

Type parameters

  • K

  • V

Hierarchy

  • Map<K, V>
    • HashMap

Implements

  • Iterable<Pair<K, V>>
  • ICopy<HashMap<K, V>>
  • IEmpty<HashMap<K, V>>
  • IEquiv

Index

Constructors

constructor

Properties

Static Map

Map: MapConstructor

Accessors

[Symbol.species]

[Symbol.toStringTag]

  • get [Symbol.toStringTag](): string

size

  • get size(): number

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<[K, V]>

clear

  • clear(): void

copy

delete

  • delete(key: K): boolean

dissoc

  • dissoc(keys: Iterable<K>): this

empty

entries

  • entries(): IterableIterator<Pair<K, V>>

equiv

  • equiv(o: any): boolean

Protected find

forEach

  • forEach(fn: Fn3<V, Readonly<K>, Map<K, V>, void>, thisArg?: any): void

get

  • get(key: K, notFound?: V): V | undefined

has

  • has(key: K): boolean

into

  • into(pairs: Iterable<Pair<K, V>>): this

keys

  • keys(): IterableIterator<K>

opts

Protected resize

set

  • set(key: K, val: V): this

values

  • values(): IterableIterator<V>

Generated using TypeDoc