UNPKG

typescript-ds-lib

Version:

A collection of TypeScript data structure implementations

21 lines (20 loc) 610 B
import { BaseCollection } from './base-collection'; export interface HashTable<K, V> { insert(key: K, value: V): void; get(key: K): V | undefined; remove(key: K): boolean; forEach(callback: (key: K, value: V) => void): void; } export declare class HashTable<K, V> extends BaseCollection<V> implements HashTable<K, V> { private table; private count; private readonly capacity; constructor(capacity?: number); size(): number; isEmpty(): boolean; clear(): void; /** * Checks if two hash tables are equal. */ equals(other: HashTable<K, V>): boolean; }