/** * DualOrderMap is a data structure that stores unique key-value pairs while * maintaining both the insertion order and a sorted order based on a provided * comparison function. This allows you to retrieve the data in two different * orders: the order of insertion and the sorted order. * * @template K The key type * @template V The value type * * @example * // Create a DualOrderMap to store numbers with string keys, * // sorting the numbers in ascending order * const compareFn = (a: { key: string; value: number }, b: { key: string; value: number }) => a.value - b.value; * const dualOrderMap = new DualOrderMap(compareFn); * * dualOrderMap.insert("one", 1); * dualOrderMap.insert("two", 2); * dualOrderMap.insert("three", 3); * * console.log(dualOrderMap.getOrderedData()); // Output: [ [ 'one', 1 ], [ 'two', 2 ], [ 'three', 3 ] ] * console.log(dualOrderMap.getSortedData()); // Output: [ [ 'one', 1 ], [ 'two', 2 ], [ 'three', 3 ] ] */ export declare class DefaultCompare { static string(a: string, b: string): number; static number(a: number, b: number): number; static dateString(a: string, b: string): number; static date(a: Date, b: Date): number; } export declare class DualOrderMap { private dataMap; private orderQueue; private sortedKeys; private readonly compareFn; hasCustomFn: (key: any, self: DualOrderMap) => boolean; constructor(compareFn?: (a: K, b: K) => number); private defaultCompareFn; insert(key: K, value: V): void; private insertSortedKey; get(key: K): V | undefined; delete(key: K): boolean; getOrderedData(): [K, V][]; getSortedData(): [K, V][]; getSortedFirstElement(): V | undefined; getSortedLastElement(): V | undefined; getAsInsertedOrderFirstElement(): V | undefined; getAsInsertedOrderLastElement(): V | undefined; hasCustom(searchKey: any): boolean; has(key: K): boolean; clear(): void; size(): number; getSortedKeys(): K[]; getOrderedKeys(): K[]; }