1
+ <!doctype html>
2
+ < html >
3
+ < head >
4
+ < link rel ="stylesheet " href ="../api_static/tomorrow-night.css ">
5
+ < link rel ="stylesheet " href ="../api_static/style.css " type ="text/css ">
6
+ < script src ="../api_static//highlight.pack.js "> </ script >
7
+ < script src ="../api_static//script.js "> </ script >
8
+ < script > hljs . initHighlightingOnLoad ( ) ; </ script >
9
+ < meta charset ="utf8 ">
10
+ < link rel ="previous " href ="Belt.HashSet.html ">
11
+ < title > Belt.HashMap </ title > </ head >
12
+ < body >
13
+ < nav class ="module-index "> < ul > < li > < a href ="Belt.html "> Belt</ a > </ li >
14
+ < li > < a href ="Belt_Array.html "> Belt_Array</ a > </ li >
15
+ < li > < a href ="Belt_HashMap.html "> Belt_HashMap</ a > </ li >
16
+ < li > < a href ="Belt_HashMapInt.html "> Belt_HashMapInt</ a > </ li >
17
+ < li > < a href ="Belt_HashMapString.html "> Belt_HashMapString</ a > </ li >
18
+ < li > < a href ="Belt_HashSet.html "> Belt_HashSet</ a > </ li >
19
+ < li > < a href ="Belt_HashSetInt.html "> Belt_HashSetInt</ a > </ li >
20
+ < li > < a href ="Belt_HashSetString.html "> Belt_HashSetString</ a > </ li >
21
+ < li > < a href ="Belt_Id.html "> Belt_Id</ a > </ li >
22
+ < li > < a href ="Belt_List.html "> Belt_List</ a > </ li >
23
+ < li > < a href ="Belt_Map.html "> Belt_Map</ a > </ li >
24
+ < li > < a href ="Belt_MapDict.html "> Belt_MapDict</ a > </ li >
25
+ < li > < a href ="Belt_MapInt.html "> Belt_MapInt</ a > </ li >
26
+ < li > < a href ="Belt_MapString.html "> Belt_MapString</ a > </ li >
27
+ < li > < a href ="Belt_MutableMap.html "> Belt_MutableMap</ a > </ li >
28
+ < li > < a href ="Belt_MutableMapInt.html "> Belt_MutableMapInt</ a > </ li >
29
+ < li > < a href ="Belt_MutableMapString.html "> Belt_MutableMapString</ a > </ li >
30
+ < li > < a href ="Belt_MutableQueue.html "> Belt_MutableQueue</ a > </ li >
31
+ < li > < a href ="Belt_MutableSet.html "> Belt_MutableSet</ a > </ li >
32
+ < li > < a href ="Belt_MutableSetInt.html "> Belt_MutableSetInt</ a > </ li >
33
+ < li > < a href ="Belt_MutableSetString.html "> Belt_MutableSetString</ a > </ li >
34
+ < li > < a href ="Belt_MutableStack.html "> Belt_MutableStack</ a > </ li >
35
+ < li > < a href ="Belt_Range.html "> Belt_Range</ a > </ li >
36
+ < li > < a href ="Belt_Set.html "> Belt_Set</ a > </ li >
37
+ < li > < a href ="Belt_SetDict.html "> Belt_SetDict</ a > </ li >
38
+ < li > < a href ="Belt_SetInt.html "> Belt_SetInt</ a > </ li >
39
+ < li > < a href ="Belt_SetString.html "> Belt_SetString</ a > </ li >
40
+ < li > < a href ="Belt_SortArray.html "> Belt_SortArray</ a > </ li >
41
+ < li > < a href ="Belt_SortArrayInt.html "> Belt_SortArrayInt</ a > </ li >
42
+ < li > < a href ="Belt_SortArrayString.html "> Belt_SortArrayString</ a > </ li >
43
+ < li > < a href ="Belt_internalAVLset.html "> Belt_internalAVLset</ a > </ li >
44
+ < li > < a href ="Belt_internalAVLtree.html "> Belt_internalAVLtree</ a > </ li >
45
+ < li > < a href ="Belt_internalBuckets.html "> Belt_internalBuckets</ a > </ li >
46
+ < li > < a href ="Belt_internalBucketsType.html "> Belt_internalBucketsType</ a > </ li >
47
+ < li > < a href ="Belt_internalMapInt.html "> Belt_internalMapInt</ a > </ li >
48
+ < li > < a href ="Belt_internalMapString.html "> Belt_internalMapString</ a > </ li >
49
+ < li > < a href ="Belt_internalMutableAVLMap.html "> Belt_internalMutableAVLMap</ a > </ li >
50
+ < li > < a href ="Belt_internalSetBuckets.html "> Belt_internalSetBuckets</ a > </ li >
51
+ < li > < a href ="Belt_internalSetInt.html "> Belt_internalSetInt</ a > </ li >
52
+ < li > < a href ="Belt_internalSetString.html "> Belt_internalSetString</ a > </ li >
53
+ < li > < a href ="Dom.html "> Dom</ a > </ li >
54
+ < li > < a href ="Dom_storage.html "> Dom_storage</ a > </ li >
55
+ < li > < a href ="Js.html "> Js</ a > </ li >
56
+ < li > < a href ="Js_array.html "> Js_array</ a > </ li >
57
+ < li > < a href ="Js_boolean.html "> Js_boolean</ a > </ li >
58
+ < li > < a href ="Js_cast.html "> Js_cast</ a > </ li >
59
+ < li > < a href ="Js_console.html "> Js_console</ a > </ li >
60
+ < li > < a href ="Js_date.html "> Js_date</ a > </ li >
61
+ < li > < a href ="Js_dict.html "> Js_dict</ a > </ li >
62
+ < li > < a href ="Js_exn.html "> Js_exn</ a > </ li >
63
+ < li > < a href ="Js_float.html "> Js_float</ a > </ li >
64
+ < li > < a href ="Js_global.html "> Js_global</ a > </ li >
65
+ < li > < a href ="Js_int.html "> Js_int</ a > </ li >
66
+ < li > < a href ="Js_int64.html "> Js_int64</ a > </ li >
67
+ < li > < a href ="Js_internal.html "> Js_internal</ a > </ li >
68
+ < li > < a href ="Js_json.html "> Js_json</ a > </ li >
69
+ < li > < a href ="Js_list.html "> Js_list</ a > </ li >
70
+ < li > < a href ="Js_mapperRt.html "> Js_mapperRt</ a > </ li >
71
+ < li > < a href ="Js_math.html "> Js_math</ a > </ li >
72
+ < li > < a href ="Js_nativeint.html "> Js_nativeint</ a > </ li >
73
+ < li > < a href ="Js_null.html "> Js_null</ a > </ li >
74
+ < li > < a href ="Js_null_undefined.html "> Js_null_undefined</ a > </ li >
75
+ < li > < a href ="Js_obj.html "> Js_obj</ a > </ li >
76
+ < li > < a href ="Js_option.html "> Js_option</ a > </ li >
77
+ < li > < a href ="Js_primitive.html "> Js_primitive</ a > </ li >
78
+ < li > < a href ="Js_promise.html "> Js_promise</ a > </ li >
79
+ < li > < a href ="Js_re.html "> Js_re</ a > </ li >
80
+ < li > < a href ="Js_result.html "> Js_result</ a > </ li >
81
+ < li > < a href ="Js_string.html "> Js_string</ a > </ li >
82
+ < li > < a href ="Js_typed_array.html "> Js_typed_array</ a > </ li >
83
+ < li > < a href ="Js_types.html "> Js_types</ a > </ li >
84
+ < li > < a href ="Js_undefined.html "> Js_undefined</ a > </ li >
85
+ < li > < a href ="Js_unsafe.html "> Js_unsafe</ a > </ li >
86
+ < li > < a href ="Js_vector.html "> Js_vector</ a > </ li >
87
+ < li > < a href ="Node.html "> Node</ a > </ li >
88
+ < li > < a href ="Node_buffer.html "> Node_buffer</ a > </ li >
89
+ < li > < a href ="Node_child_process.html "> Node_child_process</ a > </ li >
90
+ < li > < a href ="Node_fs.html "> Node_fs</ a > </ li >
91
+ < li > < a href ="Node_module.html "> Node_module</ a > </ li >
92
+ < li > < a href ="Node_path.html "> Node_path</ a > </ li >
93
+ < li > < a href ="Node_process.html "> Node_process</ a > </ li > </ ul > </ nav >
94
+ < div class ="navbar "> < a class ="pre " href ="Belt.HashSet.html " title ="Belt.HashSet "> Previous</ a >
95
+ < a class ="up " href ="Belt.html " title ="Belt "> Up</ a >
96
+ </ div >
97
+ < h1 > Module < a href ="type_Belt.HashMap.html "> Belt.HashMap</ a > </ h1 >
98
+
99
+ < pre > < span class ="keyword "> module</ span > HashMap: < code class ="type "> < a href ="Belt_HashMap.html "> Belt_HashMap</ a > </ code > </ pre > < div class ="info module top ">
100
+ < div class ="not-examples ">
101
+ < a href ="Belt.HashMap.html "> < code class ="code "> Belt.HashMap</ code > </ a >
102
+ < p >
103
+
104
+ The toplevel provides generic < b > mutable</ b > hash map operations.
105
+ < p >
106
+
107
+ It also has two specialized inner modules
108
+ < code class ="code "> Belt.HashMap.Int</ code > and < code class ="code "> Belt.HashMap.String</ code > < br >
109
+
110
+ </ div >
111
+
112
+ </ div >
113
+
114
+ < hr width ="100% ">
115
+
116
+ < pre > < span class ="keyword "> module</ span > < a href ="Belt_HashMap.Int.html "> Int</ a > : < code class ="type "> < a href ="Belt_HashMapInt.html "> Belt_HashMapInt</ a > </ code > </ pre > < div class ="info ">
117
+ < div class ="not-examples ">
118
+ Specalized when key type is < code class ="code "> int</ code > , more efficient
119
+ than the gerneic type< br >
120
+
121
+ </ div >
122
+ </ div >
123
+ < pre > < span class ="keyword "> module</ span > < a href ="Belt_HashMap.String.html "> String</ a > : < code class ="type "> < a href ="Belt_HashMapString.html "> Belt_HashMapString</ a > </ code > </ pre > < div class ="info ">
124
+ < div class ="not-examples ">
125
+ Specalized when key type is < code class ="code "> string</ code > , more efficient
126
+ than the gerneic type< br >
127
+
128
+ </ div >
129
+ </ div > < div class ="type-declaration ">
130
+ < pre > < span id ="TYPEt "> < span class ="keyword "> type</ span > < code class ="type "> ('key, 'value, 'id)</ code > t</ span > </ pre >
131
+ </ div >
132
+ < div class ="info ">
133
+ < div class ="not-examples ">
134
+ The type of hash tables from type < code class ="code "> 'key</ code > to type < code class ="code "> 'value</ code > .< br >
135
+
136
+ </ div >
137
+
138
+ </ div >
139
+
140
+
141
+ < div class ="type-declaration ">
142
+ < pre > < span id ="TYPEid "> < span class ="keyword "> type</ span > < code class ="type "> ('a, 'id)</ code > id</ span > = < code class ="type "> ('a, 'id) < a href ="Belt_Id.html#TYPEhashable "> Belt_Id.hashable</ a > </ code > </ pre >
143
+ </ div >
144
+
145
+
146
+ < pre > < span id ="VALmake "> < span class ="keyword "> val</ span > make</ span > : < code class ="type "> hintSize:int -> < br > id:('key, 'id) < a href ="Belt_HashMap.html#TYPEid "> id</ a > -> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > </ code > </ pre >
147
+ < pre > < span id ="VALclear "> < span class ="keyword "> val</ span > clear</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> unit</ code > </ pre > < div class ="info ">
148
+ < div class ="not-examples ">
149
+ Empty a hash table.< br >
150
+
151
+ </ div >
152
+
153
+ </ div >
154
+
155
+
156
+ < pre > < span id ="VALisEmpty "> < span class ="keyword "> val</ span > isEmpty</ span > : < code class ="type "> ('a, 'b, 'c) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> bool</ code > </ pre >
157
+ < pre > < span id ="VALset "> < span class ="keyword "> val</ span > set</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'key -> 'value -> unit</ code > </ pre > < div class ="info ">
158
+ < div class ="not-examples ">
159
+ < code class ="code "> set tbl k v</ code > if < code class ="code "> k</ code > does not exist,
160
+ add the binding < code class ="code "> k,v</ code > , otherwise, update the old value with the new
161
+ < code class ="code "> v</ code > < br >
162
+
163
+ </ div >
164
+
165
+ </ div >
166
+
167
+
168
+ < pre > < span id ="VALcopy "> < span class ="keyword "> val</ span > copy</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > </ code > </ pre >
169
+ < pre > < span id ="VALget "> < span class ="keyword "> val</ span > get</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'key -> 'value option</ code > </ pre >
170
+ < pre > < span id ="VALhas "> < span class ="keyword "> val</ span > has</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'key -> bool</ code > </ pre > < div class ="info ">
171
+ < div class ="not-examples ">
172
+ < code class ="code "> has tbl x</ code > checks if < code class ="code "> x</ code > is bound in < code class ="code "> tbl</ code > .< br >
173
+
174
+ </ div >
175
+
176
+ </ div >
177
+
178
+
179
+ < pre > < span id ="VALremove "> < span class ="keyword "> val</ span > remove</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'key -> unit</ code > </ pre >
180
+ < pre > < span id ="VALforEachU "> < span class ="keyword "> val</ span > forEachU</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> ('key -> 'value -> unit [@bs]) -> unit</ code > </ pre >
181
+ < pre > < span id ="VALforEach "> < span class ="keyword "> val</ span > forEach</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> ('key -> 'value -> unit) -> unit</ code > </ pre > < div class ="info ">
182
+ < div class ="not-examples ">
183
+ < code class ="code "> forEach tbl f</ code > applies < code class ="code "> f</ code > to all bindings in table < code class ="code "> tbl</ code > .
184
+ < code class ="code "> f</ code > receives the key as first argument, and the associated value
185
+ as second argument. Each binding is presented exactly once to < code class ="code "> f</ code > .< br >
186
+
187
+ </ div >
188
+
189
+ </ div >
190
+
191
+
192
+ < pre > < span id ="VALreduceU "> < span class ="keyword "> val</ span > reduceU</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> < br > 'c -> ('c -> 'key -> 'value -> 'c [@bs]) -> 'c</ code > </ pre >
193
+ < pre > < span id ="VALreduce "> < span class ="keyword "> val</ span > reduce</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> < br > 'c -> ('c -> 'key -> 'value -> 'c) -> 'c</ code > </ pre > < div class ="info ">
194
+ < div class ="not-examples ">
195
+ < code class ="code "> reduce tbl init f</ code > computes
196
+ < code class ="code "> (f kN dN ... (f k1 d1 init)...)</ code > ,
197
+ where < code class ="code "> k1 ... kN</ code > are the keys of all bindings in < code class ="code "> tbl</ code > ,
198
+ and < code class ="code "> d1 ... dN</ code > are the associated values.
199
+ Each binding is presented exactly once to < code class ="code "> f</ code > .
200
+ < p >
201
+
202
+ The order in which the bindings are passed to < code class ="code "> f</ code > is unspecified.
203
+ However, if the table contains several bindings for the same key,
204
+ they are passed to < code class ="code "> f</ code > in reverse order of introduction, that is,
205
+ the most recent binding is passed first.< br >
206
+
207
+ </ div >
208
+
209
+ </ div >
210
+
211
+
212
+ < pre > < span id ="VALkeepMapInPlaceU "> < span class ="keyword "> val</ span > keepMapInPlaceU</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> < br > ('key -> 'value -> 'value option [@bs]) -> unit</ code > </ pre >
213
+ < pre > < span id ="VALkeepMapInPlace "> < span class ="keyword "> val</ span > keepMapInPlace</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> < br > ('key -> 'value -> 'value option) -> unit</ code > </ pre >
214
+ < pre > < span id ="VALsize "> < span class ="keyword "> val</ span > size</ span > : < code class ="type "> ('a, 'b, 'c) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> int</ code > </ pre > < div class ="info ">
215
+ < div class ="not-examples ">
216
+ < code class ="code "> size tbl</ code > returns the number of bindings in < code class ="code "> tbl</ code > .
217
+ It takes constant time.< br >
218
+
219
+ </ div >
220
+
221
+ </ div >
222
+
223
+
224
+ < pre > < span id ="VALtoArray "> < span class ="keyword "> val</ span > toArray</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> ('key * 'value) array</ code > </ pre >
225
+ < pre > < span id ="VALkeysToArray "> < span class ="keyword "> val</ span > keysToArray</ span > : < code class ="type "> ('key, 'a, 'b) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'key array</ code > </ pre >
226
+ < pre > < span id ="VALvaluesToArray "> < span class ="keyword "> val</ span > valuesToArray</ span > : < code class ="type "> ('a, 'value, 'b) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> 'value array</ code > </ pre >
227
+ < pre > < span id ="VALofArray "> < span class ="keyword "> val</ span > ofArray</ span > : < code class ="type "> ('key * 'value) array -> < br > id:('key, 'id) < a href ="Belt_HashMap.html#TYPEid "> id</ a > -> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > </ code > </ pre >
228
+ < pre > < span id ="VALmergeMany "> < span class ="keyword "> val</ span > mergeMany</ span > : < code class ="type "> ('key, 'value, 'id) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> ('key * 'value) array -> unit</ code > </ pre >
229
+ < pre > < span id ="VALgetBucketHistogram "> < span class ="keyword "> val</ span > getBucketHistogram</ span > : < code class ="type "> ('a, 'b, 'c) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> int array</ code > </ pre >
230
+ < pre > < span id ="VALlogStats "> < span class ="keyword "> val</ span > logStats</ span > : < code class ="type "> ('a, 'b, 'c) < a href ="Belt_HashMap.html#TYPEt "> t</ a > -> unit</ code > </ pre > </ body > </ html >
0 commit comments