export class HashMap { private map = new Map() get [Symbol.toStringTag](): string { return this.constructor.name } get size(): number { return this.map.size } constructor(private hash: (key: K) => Hash) {} set(key: K, value: V): this { this.map.set(this.hash(key), value) return this } has(key: K): boolean { return this.map.has(this.hash(key)) } get(key: K): V | undefined { return this.map.get(this.hash(key)) } delete(key: K): boolean { return this.map.delete(this.hash(key)) } clear(): void { this.map.clear() } values(): IterableIterator { return this.map.values() } }