forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashmap.d.ts
71 lines (61 loc) · 1.46 KB
/
hashmap.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Type definitions for HashMap 1.1.0
// Project: https://github.com/flesler/hashmap
// Definitions by: Rafał Wrzeszcz <http://wrzasq.pl>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class HashMap<KeyType, ValueType> {
/**
* Return value from hashmap.
*
* @param key Key.
* @return Value stored under given key.
*/
get(key : KeyType) : ValueType;
/**
* Store value in hashmap.
*
* @param key Key.
* @param value Value.
*/
set(key : KeyType, value : ValueType) : void;
/**
* Checks if given key exists in hashmap.
*
* @param key Key.
* @return Whether given key exists in hashmap.
*/
has(key : KeyType) : boolean;
/**
* Removes given key from hashmap.
*
* @param key Key.
*/
remove(key : KeyType) : void;
/**
* Returns all contained keys.
*
* @return List of keys.
*/
keys() : KeyType[];
/**
* Returns all container values.
*
* @return List of values.
*/
values() : ValueType[];
/**
* Returns size of hashmap (number of entries).
*
* @return Number of entries in hashmap.
*/
count() : number;
/**
* Clears hashmap.
*/
clear() : void;
/**
* Iterates over hashmap.
*
* @param callback Function to be invoked for every hashmap entry.
*/
forEach(callback : (value : ValueType, key : KeyType) => void) : void;
}