This commit is contained in:
parent
c612da125e
commit
046d4d97bd
@ -1,6 +1,6 @@
|
|||||||
type Comparator<K, V> = (a: [K, V], b: [K, V]) => number;
|
type Comparator<K, V> = (a: [K, V], b: [K, V]) => number;
|
||||||
|
|
||||||
export class SortedMap<K, V> {
|
export class SortedMap<K, V extends Record<string, any>> {
|
||||||
private map: Map<K, V>;
|
private map: Map<K, V>;
|
||||||
private sortedKeys: K[];
|
private sortedKeys: K[];
|
||||||
private compare: Comparator<K, V>;
|
private compare: Comparator<K, V>;
|
||||||
@ -149,11 +149,12 @@ export class SortedMap<K, V> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
this.map.clear();
|
||||||
|
this.sortedKeys = [];
|
||||||
|
}
|
||||||
|
|
||||||
get size(): number {
|
get size(): number {
|
||||||
return this.map.size;
|
return this.map.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
|
||||||
this.map.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user