1 | import { HashTable } from "../hashtable/HashTable";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | export class HashMap<T>{
|
7 | private map: HashTable<T>;
|
8 | constructor(capacity?: number){
|
9 | this.map = new HashTable(capacity);
|
10 | }
|
11 |
|
12 | get Count() {
|
13 | return this.map.Count;
|
14 | }
|
15 |
|
16 | put(key: string, value: T) {
|
17 | const self = this;
|
18 | self.map.put(key, value);
|
19 | return self;
|
20 | }
|
21 |
|
22 | get(key: string) {
|
23 | return this.map.get(key);
|
24 | }
|
25 |
|
26 | clear() {
|
27 | return this.map.clear();
|
28 | }
|
29 |
|
30 | remove(key: string) {
|
31 | return this.map.remove(key);
|
32 | }
|
33 |
|
34 | keys() {
|
35 | return this.map.getKeys();
|
36 | }
|
37 |
|
38 | values() {
|
39 | return this.map.values();
|
40 | }
|
41 |
|
42 | contains(key: string) {
|
43 | return this.map.contains(key);
|
44 | }
|
45 | }
|