UNPKG

ts-jsdk

Version:

TypeScript implementation of the Java platform

34 lines 929 B
import { JIterator } from "./JIterator"; export class HashMap { constructor() { this._map = new Map(); } entries() { const entries = this._map.entries(); const subIt = new class { next() { let next = entries.next(); const [k, v] = next.value; return { done: next.done, value: new class { constructor() { this.getKey = () => k; this.getValue = () => v; } } }; } }; return new JIterator(subIt); } get(key) { return this._map.get(key); } put(key, value) { const existing = this._map.get(key); this._map.set(key, value); return existing; } } //# sourceMappingURL=HashMap.js.map