SortedMap.clear(), V type
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2024-01-04 18:49:05 +02:00
parent c612da125e
commit 046d4d97bd

View File

@ -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();
}
} }