forked from qwertie/btree-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsorted-array.d.ts
22 lines (22 loc) · 868 Bytes
/
sorted-array.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { IMap } from './interfaces';
/** A super-inefficient sorted list for testing purposes */
export default class SortedArray<K = any, V = any> implements IMap<K, V> {
a: [K, V][];
cmp: (a: K, b: K) => number;
constructor(entries?: [K, V][], compare?: (a: K, b: K) => number);
get size(): number;
get(key: K, defaultValue?: V): V | undefined;
set(key: K, value: V, overwrite?: boolean): boolean;
has(key: K): boolean;
delete(key: K): boolean;
clear(): void;
getArray(): [K, V][];
minKey(): K | undefined;
maxKey(): K | undefined;
forEach(callbackFn: (v: V, k: K, list: SortedArray<K, V>) => void): void;
[Symbol.iterator](): IterableIterator<[K, V]>;
entries(): IterableIterator<[K, V]>;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
indexOf(key: K, failXor: number): number;
}