export default class TreeMap extends Map { /** * A function that defines the sort order of the keys. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description */ private compareFn; private sortedKeys; private specifiedCompareFn; get comparator(): (a: K, b: K) => number; private isCompareFn; private compare; /** * @param compareFn A function that defines the sort order of the keys. */ constructor(compareFn?: (a: K, b: K) => number); /** * @param entries entries * @param compareFn A function that defines the sort order of the keys. */ constructor(entries?: readonly (readonly [K, V])[] | null, compareFn?: (a: K, b: K) => number); /** * @param iterable Iterable object * @param compareFn A function that defines the sort order of the keys. */ constructor(iterable?: IterableIterator<[K, V]>, compareFn?: (a: K, b: K) => number); /** * @param map `Map` object * @param compareFn A function that defines the sort order of the keys. */ constructor(map?: Map, compareFn?: (a: K, b: K) => number); private _constructor; /** * Creates and returns a new `TreeMap` object from the given map. * @param map Map object * @param compareFn Specifies a function that defines the sort order of the keys */ static fromMap(map: Map, compareFn?: (a: K, b: K) => number): TreeMap; /** * Duplicates this map and returns it as a new `TreeMap` object. */ duplicate(): TreeMap; /** * Returns this map as a new `Map` object. */ toMap(): Map; reverseKeys(): IterableIterator; get(key: K): V | undefined; /** * Adds or updates entry with the specified value with the specified key in this map. * @param key * @param value */ set(key: K, value: V): this; /** * Copies all of the entries from the given map to this map. * @param map */ setAll(map: Map): this; /** * Removes the entry for given key from this map and returns `true` if present. * @param key */ delete(key: K): boolean; /** * Removes all of the entry from this map. */ clear(): void; /** * Returns an iterable of sorted keys in this map. */ keys(): IterableIterator; /** * Returns an iterable of sorted values in this map. */ values(): IterableIterator; /** * Returns an iterable of sorted entries in this map. */ entries(): IterableIterator<[K, V]>; /** * Returns the first entry currently in this map, or `undefined` if the map is empty. */ firstEntry(): [K, V] | undefined; /** * Returns the first key currently in this map, or `undefined` if the map is empty. */ firstKey(): K | undefined; /** * Returns the last entry currently in this map, or `undefined` if the map is empty. */ lastEntry(): [K, V] | undefined; /** * Returns the last key currently in this map, or `undefined` if the map is empty. */ lastKey(): K | undefined; /** * Removes the first element of this map and returns that removed entry, * or `undefined` if the map is empty. */ shiftEntry(): [K, V] | undefined; /** * Removes the last element of this map and returns that removed entry, * or `undefined` if the map is empty. */ popEntry(): [K, V] | undefined; /** * Returns entry associated with the greatest key from the keys less than or equal to the specified key, * or `undefined` if there is no such key. * @param key */ floorEntry(key: K): [K, V] | undefined; /** * Returns the greatest key from the keys less than or equal to the specified key, * or `undefined` if there is no such key. * @param key */ floorKey(key: K): K | undefined; /** * Returns entry associated with the least key from the keys greater than or equal to the specified key, * or `undefined` if there is no such key. * @param key */ ceilingEntry(key: K): [K, V] | undefined; /** * Returns the least key from the keys greater than or equal to the specified key, * or `undefined` if there is no such key. * @param key */ ceilingKey(key: K): K | undefined; /** * Returns entry associated with the greatest key from the keys less than the specified key, * or `undefined` if there is no such key. * @param key */ lowerEntry(key: K): [K, V] | undefined; /** * Returns the greatest key from the keys less than the specified key, * or `undefined` if there is no such key. * @param key */ lowerKey(key: K): K | undefined; /** * Returns entry associated with the least key from the keys greater than the specified key, * or `undefined` if there is no such key. * @param key */ higherEntry(key: K): [K, V] | undefined; /** * Returns the least key from the keys greater than the specified key, * or `undefined` if there is no such key. * @param key */ higherKey(key: K): K | undefined; /** * Returns a new TreeMap with entries containing keys less than (or equal to) `key` in this map. * @param key * @param include If `true`, split this map including an entry associated with `key`. Default is `true`. */ splitLower(key: K, include?: boolean): TreeMap; /** * Returns a new TreeMap with entries containing keys greater than (or equal to) `key` in this map. * @param key * @param include If `true`, split this map including an entry associated with `key`. Default is `true`. */ splitHigher(key: K, include?: boolean): TreeMap; forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: unknown): void; } export * from './Types';