• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkTS
19 */
20
21/**
22 * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value.
23 * TreeMap is implemented using a red-black tree, which is a binary search tree where keys
24 * are stored in sorted order for efficient insertion and removal.
25 *
26 * @syscap SystemCapability.Utils.Lang
27 * @since 8
28 */
29/**
30 * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value.
31 * TreeMap is implemented using a red-black tree, which is a binary search tree where keys
32 * are stored in sorted order for efficient insertion and removal.
33 *
34 * @syscap SystemCapability.Utils.Lang
35 * @crossplatform
36 * @since 10
37 */
38/**
39 * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value.
40 * TreeMap is implemented using a red-black tree, which is a binary search tree where keys
41 * are stored in sorted order for efficient insertion and removal.
42 *
43 * @syscap SystemCapability.Utils.Lang
44 * @crossplatform
45 * @atomicservice
46 * @since arkts {'1.1':'12', '1.2':'20'}
47 * @arkts 1.1&1.2
48 */
49declare class TreeMap<K, V> {
50  /**
51   * A constructor used to create a TreeMap object.
52   *
53   * @param { function } [comparator] - comparator
54   * comparator (Optional) User-defined comparison functions.
55   * firstValue (required) previous element.
56   * secondValue (required) next element.
57   * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked.
58   * @throws { BusinessError } 401 - Parameter error. Possible causes:
59   * 1.Incorrect parameter types;
60   * 2.Parameter verification failed.
61   * @syscap SystemCapability.Utils.Lang
62   * @since 8
63   */
64  /**
65   * A constructor used to create a TreeMap object.
66   *
67   * @param { function } [comparator] - comparator
68   * comparator (Optional) User-defined comparison functions.
69   * firstValue (required) previous element.
70   * secondValue (required) next element.
71   * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked.
72   * @throws { BusinessError } 401 - Parameter error. Possible causes:
73   * 1.Incorrect parameter types;
74   * 2.Parameter verification failed.
75   * @syscap SystemCapability.Utils.Lang
76   * @crossplatform
77   * @since 10
78   */
79  /**
80   * A constructor used to create a TreeMap object.
81   *
82   * @param { function } [comparator] - comparator
83   * comparator (Optional) User-defined comparison functions.
84   * firstValue (required) previous element.
85   * secondValue (required) next element.
86   * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked.
87   * @throws { BusinessError } 401 - Parameter error. Possible causes:
88   * 1.Incorrect parameter types;
89   * 2.Parameter verification failed.
90   * @syscap SystemCapability.Utils.Lang
91   * @crossplatform
92   * @atomicservice
93   * @since 12
94   */
95  constructor(comparator?: (firstValue: K, secondValue: K) => boolean);
96
97  /**
98   * A constructor used to create a TreeMap object.
99   *
100   * @param { TreeMapComparator<K> } [comparator] - comparator
101   * comparator (Optional) User-defined comparison functions.
102   * @syscap SystemCapability.Utils.Lang
103   * @crossplatform
104   * @atomicservice
105   * @since 20
106   * @arkts 1.2
107   */
108  constructor(comparator?: TreeMapComparator<K>);
109
110  /**
111   * Gets the element number of the hashmap.
112   *
113   * @type { number }
114   * @syscap SystemCapability.Utils.Lang
115   * @since 8
116   */
117  /**
118   * Gets the element number of the hashmap.
119   *
120   * @type { number }
121   * @syscap SystemCapability.Utils.Lang
122   * @crossplatform
123   * @since 10
124   */
125  /**
126   * Gets the element number of the hashmap.
127   *
128   * @type { number }
129   * @syscap SystemCapability.Utils.Lang
130   * @crossplatform
131   * @atomicservice
132   * @since 12
133   */
134  length: number;
135
136  /**
137   * Gets the element number of the TreeMap.
138   *
139   * @type { number }
140   * @syscap SystemCapability.Utils.Lang
141   * @crossplatform
142   * @atomicservice
143   * @since 20
144   * @arkts 1.2
145   */
146  get length(): number;
147
148  /**
149   * Returns whether the Map object contains elements
150   *
151   * @returns { boolean } the boolean type
152   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
153   * @syscap SystemCapability.Utils.Lang
154   * @since 8
155   */
156  /**
157   * Returns whether the Map object contains elements
158   *
159   * @returns { boolean } the boolean type
160   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
161   * @syscap SystemCapability.Utils.Lang
162   * @crossplatform
163   * @since 10
164   */
165  /**
166   * Returns whether the Map object contains elements
167   *
168   * @returns { boolean } the boolean type
169   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
170   * @syscap SystemCapability.Utils.Lang
171   * @crossplatform
172   * @atomicservice
173   * @since arkts {'1.1':'12', '1.2':'20'}
174   * @arkts 1.1&1.2
175   */
176  isEmpty(): boolean;
177  /**
178   * Returns whether a key is contained in this map
179   *
180   * @param { K } key - key key need to determine whether to include the key
181   * @returns { boolean } the boolean type
182   * @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
183   * @syscap SystemCapability.Utils.Lang
184   * @since 8
185   */
186  /**
187   * Returns whether a key is contained in this map
188   *
189   * @param { K } key - key key need to determine whether to include the key
190   * @returns { boolean } the boolean type
191   * @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
192   * @syscap SystemCapability.Utils.Lang
193   * @crossplatform
194   * @since 10
195   */
196  /**
197   * Returns whether a key is contained in this map
198   *
199   * @param { K } key - key key need to determine whether to include the key
200   * @returns { boolean } the boolean type
201   * @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
202   * @syscap SystemCapability.Utils.Lang
203   * @crossplatform
204   * @atomicservice
205   * @since arkts {'1.1':'12', '1.2':'20'}
206   * @arkts 1.1&1.2
207   */
208  hasKey(key: K): boolean;
209  /**
210   * Returns whether a value is contained in this map
211   *
212   * @param { V } value - value value value need to determine whether to include the value
213   * @returns { boolean } the boolean type
214   * @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
215   * @syscap SystemCapability.Utils.Lang
216   * @since 8
217   */
218  /**
219   * Returns whether a value is contained in this map
220   *
221   * @param { V } value - value value value need to determine whether to include the value
222   * @returns { boolean } the boolean type
223   * @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
224   * @syscap SystemCapability.Utils.Lang
225   * @crossplatform
226   * @since 10
227   */
228  /**
229   * Returns whether a value is contained in this map
230   *
231   * @param { V } value - value value value need to determine whether to include the value
232   * @returns { boolean } the boolean type
233   * @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
234   * @syscap SystemCapability.Utils.Lang
235   * @crossplatform
236   * @atomicservice
237   * @since arkts {'1.1':'12', '1.2':'20'}
238   * @arkts 1.1&1.2
239   */
240  hasValue(value: V): boolean;
241  /**
242   * Returns a specified element in a Map object, or undefined if there is no corresponding element
243   *
244   * @param { K } key - key key the index in TreeMap
245   * @returns { V } value or undefined
246   * @throws { BusinessError } 10200011 - The get method cannot be bound.
247   * @syscap SystemCapability.Utils.Lang
248   * @since 8
249   */
250  /**
251   * Returns a specified element in a Map object, or undefined if there is no corresponding element
252   *
253   * @param { K } key - key key the index in TreeMap
254   * @returns { V } value or undefined
255   * @throws { BusinessError } 10200011 - The get method cannot be bound.
256   * @syscap SystemCapability.Utils.Lang
257   * @crossplatform
258   * @since 10
259   */
260  /**
261   * Returns a specified element in a Map object, or undefined if there is no corresponding element
262   *
263   * @param { K } key - key key the index in TreeMap
264   * @returns { V } value or undefined
265   * @throws { BusinessError } 10200011 - The get method cannot be bound.
266   * @syscap SystemCapability.Utils.Lang
267   * @crossplatform
268   * @atomicservice
269   * @since 12
270   */
271  get(key: K): V;
272  /**
273   * Obtains the first sorted key in the treemap.
274   * Or returns undefined if tree map is empty
275   *
276   * @returns { K } value or undefined
277   * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound.
278   * @syscap SystemCapability.Utils.Lang
279   * @since 8
280   */
281  /**
282   * Obtains the first sorted key in the treemap.
283   * Or returns undefined if tree map is empty
284   *
285   * @returns { K } value or undefined
286   * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound.
287   * @syscap SystemCapability.Utils.Lang
288   * @crossplatform
289   * @since 10
290   */
291  /**
292   * Obtains the first sorted key in the treemap.
293   * Or returns undefined if tree map is empty
294   *
295   * @returns { K } value or undefined
296   * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound.
297   * @syscap SystemCapability.Utils.Lang
298   * @crossplatform
299   * @atomicservice
300   * @since 12
301   */
302  getFirstKey(): K;
303  /**
304   * Obtains the last sorted key in the treemap.
305   * Or returns undefined if tree map is empty
306   *
307   * @returns { K } value or undefined
308   * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound.
309   * @syscap SystemCapability.Utils.Lang
310   * @since 8
311   */
312  /**
313   * Obtains the last sorted key in the treemap.
314   * Or returns undefined if tree map is empty
315   *
316   * @returns { K } value or undefined
317   * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound.
318   * @syscap SystemCapability.Utils.Lang
319   * @crossplatform
320   * @since 10
321   */
322  /**
323   * Obtains the last sorted key in the treemap.
324   * Or returns undefined if tree map is empty
325   *
326   * @returns { K } value or undefined
327   * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound.
328   * @syscap SystemCapability.Utils.Lang
329   * @crossplatform
330   * @atomicservice
331   * @since 12
332   */
333  getLastKey(): K;
334
335  /**
336   * Returns a specified element in a Map object, or undefined if there is no corresponding element
337   *
338   * @param { K } key - key key the index in TreeMap
339   * @returns { V | undefined } value if associated with key presents, undefined otherwise
340   * @syscap SystemCapability.Utils.Lang
341   * @crossplatform
342   * @atomicservice
343   * @since 20
344   * @arkts 1.2
345   */
346  get(key: K): V | undefined;
347
348  /**
349   * Obtains the first sorted key in the treemap.
350   * Or returns undefined if tree map is empty
351   *
352   * @returns { K | undefined } the key of the first element if exists, undefined otherwise
353   * @syscap SystemCapability.Utils.Lang
354   * @crossplatform
355   * @atomicservice
356   * @since 20
357   * @arkts 1.2
358   */
359  getFirstKey(): K | undefined;
360
361  /**
362   * Obtains the last sorted key in the treemap.
363   * Or returns undefined if tree map is empty
364   *
365   * @returns { K | undefined } the key of the last element if exists, undefined otherwise
366   * @syscap SystemCapability.Utils.Lang
367   * @crossplatform
368   * @atomicservice
369   * @since 20
370   * @arkts 1.2
371   */
372  getLastKey(): K | undefined;
373
374  /**
375   * Adds all element groups in one map to another map
376   *
377   * @param { TreeMap<K, V> } map - map map the Map object to add members
378   * @throws { BusinessError } 10200011 - The setAll method cannot be bound.
379   * @throws { BusinessError } 401 - Parameter error. Possible causes:
380   * 1.Mandatory parameters are left unspecified;
381   * 2.Incorrect parameter types.
382   * @syscap SystemCapability.Utils.Lang
383   * @since 8
384   */
385  /**
386   * Adds all element groups in one map to another map
387   *
388   * @param { TreeMap<K, V> } map - map map the Map object to add members
389   * @throws { BusinessError } 10200011 - The setAll method cannot be bound.
390   * @throws { BusinessError } 401 - Parameter error. Possible causes:
391   * 1.Mandatory parameters are left unspecified;
392   * 2.Incorrect parameter types.
393   * @syscap SystemCapability.Utils.Lang
394   * @crossplatform
395   * @since 10
396   */
397  /**
398   * Adds all element groups in one map to another map
399   *
400   * @param { TreeMap<K, V> } map - map map the Map object to add members
401   * @throws { BusinessError } 10200011 - The setAll method cannot be bound.
402   * @throws { BusinessError } 401 - Parameter error. Possible causes:
403   * 1.Mandatory parameters are left unspecified;
404   * 2.Incorrect parameter types.
405   * @syscap SystemCapability.Utils.Lang
406   * @crossplatform
407   * @atomicservice
408   * @since arkts {'1.1':'12', '1.2':'20'}
409   * @arkts 1.1&1.2
410   */
411  setAll(map: TreeMap<K, V>): void;
412  /**
413   * Adds or updates a(new) key-value pair with a key and value specified for the Map object
414   *
415   * @param { K } key - key key Added or updated targets
416   * @param { V } value - value value Added or updated value
417   * @returns { Object } the map object after set
418   * @throws { BusinessError } 10200011 - The set method cannot be bound.
419   * @throws { BusinessError } 401 - Parameter error. Possible causes:
420   * 1.Mandatory parameters are left unspecified;
421   * 2.Incorrect parameter types;
422   * 3.Parameter verification failed.
423   * @syscap SystemCapability.Utils.Lang
424   * @since 8
425   */
426  /**
427   * Adds or updates a(new) key-value pair with a key and value specified for the Map object
428   *
429   * @param { K } key - key key Added or updated targets
430   * @param { V } value - value value Added or updated value
431   * @returns { Object } the map object after set
432   * @throws { BusinessError } 10200011 - The set method cannot be bound.
433   * @throws { BusinessError } 401 - Parameter error. Possible causes:
434   * 1.Mandatory parameters are left unspecified;
435   * 2.Incorrect parameter types;
436   * 3.Parameter verification failed.
437   * @syscap SystemCapability.Utils.Lang
438   * @crossplatform
439   * @since 10
440   */
441  /**
442   * Adds or updates a(new) key-value pair with a key and value specified for the Map object
443   *
444   * @param { K } key - key key Added or updated targets
445   * @param { V } value - value value Added or updated value
446   * @returns { Object } the map object after set
447   * @throws { BusinessError } 10200011 - The set method cannot be bound.
448   * @throws { BusinessError } 401 - Parameter error. Possible causes:
449   * 1.Mandatory parameters are left unspecified;
450   * 2.Incorrect parameter types;
451   * 3.Parameter verification failed.
452   * @syscap SystemCapability.Utils.Lang
453   * @crossplatform
454   * @atomicservice
455   * @since arkts {'1.1':'12', '1.2':'20'}
456   * @arkts 1.1&1.2
457   */
458  set(key: K, value: V): Object;
459  /**
460   * Remove a specified element from a Map object
461   *
462   * @param { K } key - key key Target to be deleted
463   * @returns { V } Target mapped value
464   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
465   * @syscap SystemCapability.Utils.Lang
466   * @since 8
467   */
468  /**
469   * Remove a specified element from a Map object
470   *
471   * @param { K } key - key key Target to be deleted
472   * @returns { V } Target mapped value
473   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
474   * @syscap SystemCapability.Utils.Lang
475   * @crossplatform
476   * @since 10
477   */
478  /**
479   * Remove a specified element from a Map object
480   *
481   * @param { K } key - key key Target to be deleted
482   * @returns { V } Target mapped value
483   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
484   * @syscap SystemCapability.Utils.Lang
485   * @crossplatform
486   * @atomicservice
487   * @since 12
488   */
489  remove(key: K): V;
490
491  /**
492   * Remove a specified element from a Map object
493   *
494   * @param { K } key - key key Target to be deleted
495   * @returns { V | undefined } the value of the removed element, undefined otherwise
496   * @syscap SystemCapability.Utils.Lang
497   * @crossplatform
498   * @atomicservice
499   * @since 20
500   * @arkts 1.2
501   */
502  remove(key: K): V | undefined;
503
504  /**
505   * Clear all element groups in the map
506   *
507   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
508   * @syscap SystemCapability.Utils.Lang
509   * @since 8
510   */
511  /**
512   * Clear all element groups in the map
513   *
514   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
515   * @syscap SystemCapability.Utils.Lang
516   * @crossplatform
517   * @since 10
518   */
519  /**
520   * Clear all element groups in the map
521   *
522   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
523   * @syscap SystemCapability.Utils.Lang
524   * @crossplatform
525   * @atomicservice
526   * @since arkts {'1.1':'12', '1.2':'20'}
527   * @arkts 1.1&1.2
528   */
529  clear(): void;
530  /**
531   * Returns the greatest element smaller than or equal to the specified key
532   * if the key does not exist, undefined is returned
533   *
534   * @param { K } key - key key Objective of comparison
535   * @returns { K } key or undefined
536   * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound.
537   * @syscap SystemCapability.Utils.Lang
538   * @since 8
539   */
540  /**
541   * Returns the greatest element smaller than or equal to the specified key
542   * if the key does not exist, undefined is returned
543   *
544   * @param { K } key - key key Objective of comparison
545   * @returns { K } key or undefined
546   * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound.
547   * @syscap SystemCapability.Utils.Lang
548   * @crossplatform
549   * @since 10
550   */
551  /**
552   * Returns the greatest element smaller than or equal to the specified key
553   * if the key does not exist, undefined is returned
554   *
555   * @param { K } key - key key Objective of comparison
556   * @returns { K } key or undefined
557   * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound.
558   * @syscap SystemCapability.Utils.Lang
559   * @crossplatform
560   * @atomicservice
561   * @since 12
562   */
563  getLowerKey(key: K): K;
564  /**
565   * Returns the least element greater than or equal to the specified key
566   * if the key does not exist, undefined is returned
567   *
568   * @param { K } key - key key Objective of comparison
569   * @returns { K } key or undefined
570   * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound.
571   * @syscap SystemCapability.Utils.Lang
572   * @since 8
573   */
574  /**
575   * Returns the least element greater than or equal to the specified key
576   * if the key does not exist, undefined is returned
577   *
578   * @param { K } key - key key Objective of comparison
579   * @returns { K } key or undefined
580   * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound.
581   * @syscap SystemCapability.Utils.Lang
582   * @crossplatform
583   * @since 10
584   */
585  /**
586   * Returns the least element greater than or equal to the specified key
587   * if the key does not exist, undefined is returned
588   *
589   * @param { K } key - key key Objective of comparison
590   * @returns { K } key or undefined
591   * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound.
592   * @syscap SystemCapability.Utils.Lang
593   * @crossplatform
594   * @atomicservice
595   * @since 12
596   */
597  getHigherKey(key: K): K;
598
599  /**
600   * Returns the greatest element smaller than or equal to the specified key
601   * if the key does not exist, undefined is returned
602   *
603   * @param { K } key - key key Objective of comparison
604   * @returns { K | undefined } the lower key of the given key's element if exists, undefined otherwise
605   * @syscap SystemCapability.Utils.Lang
606   * @crossplatform
607   * @atomicservice
608   * @since 20
609   * @arkts 1.2
610   */
611  getLowerKey(key: K): K | undefined;
612
613  /**
614   * Returns the least element greater than or equal to the specified key
615   * if the key does not exist, undefined is returned
616   *
617   * @param { K } key - key key Objective of comparison
618   * @returns { K | undefined } the higher key of the given key's element if exists, undefined otherwise
619   * @syscap SystemCapability.Utils.Lang
620   * @crossplatform
621   * @atomicservice
622   * @since 20
623   * @arkts 1.2
624   */
625  getHigherKey(key: K): K | undefined;
626
627  /**
628   * Returns a new Iterator object that contains the keys contained in this map
629   *
630   * @returns { IterableIterator<K> }
631   * @throws { BusinessError } 10200011 - The keys method cannot be bound.
632   * @syscap SystemCapability.Utils.Lang
633   * @since 8
634   */
635  /**
636   * Returns a new Iterator object that contains the keys contained in this map
637   *
638   * @returns { IterableIterator<K> }
639   * @throws { BusinessError } 10200011 - The keys method cannot be bound.
640   * @syscap SystemCapability.Utils.Lang
641   * @crossplatform
642   * @since 10
643   */
644  /**
645   * Returns a new Iterator object that contains the keys contained in this map
646   *
647   * @returns { IterableIterator<K> }
648   * @throws { BusinessError } 10200011 - The keys method cannot be bound.
649   * @syscap SystemCapability.Utils.Lang
650   * @crossplatform
651   * @atomicservice
652   * @since arkts {'1.1':'12', '1.2':'20'}
653   * @arkts 1.1&1.2
654   */
655  keys(): IterableIterator<K>;
656  /**
657   * Returns a new Iterator object that contains the values contained in this map
658   *
659   * @returns { IterableIterator<V> }
660   * @throws { BusinessError } 10200011 - The values method cannot be bound.
661   * @syscap SystemCapability.Utils.Lang
662   * @since 8
663   */
664  /**
665   * Returns a new Iterator object that contains the values contained in this map
666   *
667   * @returns { IterableIterator<V> }
668   * @throws { BusinessError } 10200011 - The values method cannot be bound.
669   * @syscap SystemCapability.Utils.Lang
670   * @crossplatform
671   * @since 10
672   */
673  /**
674   * Returns a new Iterator object that contains the values contained in this map
675   *
676   * @returns { IterableIterator<V> }
677   * @throws { BusinessError } 10200011 - The values method cannot be bound.
678   * @syscap SystemCapability.Utils.Lang
679   * @crossplatform
680   * @atomicservice
681   * @since arkts {'1.1':'12', '1.2':'20'}
682   * @arkts 1.1&1.2
683   */
684  values(): IterableIterator<V>;
685  /**
686   * Replace the old value by new value corresponding to the specified key
687   *
688   * @param { K } key - key key Updated targets
689   * @param { V } newValue - newValue newValue Updated the target mapped value
690   * @returns { boolean } the boolean type(Is there a target pointed to by the key)
691   * @throws { BusinessError } 10200011 - The replace method cannot be bound.
692   * @syscap SystemCapability.Utils.Lang
693   * @since 8
694   */
695  /**
696   * Replace the old value by new value corresponding to the specified key
697   *
698   * @param { K } key - key key Updated targets
699   * @param { V } newValue - newValue newValue Updated the target mapped value
700   * @returns { boolean } the boolean type(Is there a target pointed to by the key)
701   * @throws { BusinessError } 10200011 - The replace method cannot be bound.
702   * @syscap SystemCapability.Utils.Lang
703   * @crossplatform
704   * @since 10
705   */
706  /**
707   * Replace the old value by new value corresponding to the specified key
708   *
709   * @param { K } key - key key Updated targets
710   * @param { V } newValue - newValue newValue Updated the target mapped value
711   * @returns { boolean } the boolean type(Is there a target pointed to by the key)
712   * @throws { BusinessError } 10200011 - The replace method cannot be bound.
713   * @syscap SystemCapability.Utils.Lang
714   * @crossplatform
715   * @atomicservice
716   * @since arkts {'1.1':'12', '1.2':'20'}
717   * @arkts 1.1&1.2
718   */
719  replace(key: K, newValue: V): boolean;
720  /**
721   * Executes the given callback function once for each real key in the map.
722   * It does not perform functions on deleted keys
723   *
724   * @param { function } callbackFn - callbackFn
725   * callbackFn (required) A function that accepts up to three arguments.
726   * The function to be called for each element.
727   * @param { Object } [thisArg] - thisArg
728   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
729   * If thisArg is omitted, undefined is used as the this value.
730   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
731   * @throws { BusinessError } 401 - Parameter error. Possible causes:
732   * 1.Mandatory parameters are left unspecified;
733   * 2.Incorrect parameter types.
734   * @syscap SystemCapability.Utils.Lang
735   * @since 8
736   */
737  /**
738   * Executes the given callback function once for each real key in the map.
739   * It does not perform functions on deleted keys
740   *
741   * @param { function } callbackFn - callbackFn
742   * callbackFn (required) A function that accepts up to three arguments.
743   * The function to be called for each element.
744   * @param { Object } [thisArg] - thisArg
745   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
746   * If thisArg is omitted, undefined is used as the this value.
747   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
748   * @throws { BusinessError } 401 - Parameter error. Possible causes:
749   * 1.Mandatory parameters are left unspecified;
750   * 2.Incorrect parameter types.
751   * @syscap SystemCapability.Utils.Lang
752   * @crossplatform
753   * @since 10
754   */
755  /**
756   * Executes the given callback function once for each real key in the map.
757   * It does not perform functions on deleted keys
758   *
759   * @param { function } callbackFn - callbackFn
760   * callbackFn (required) A function that accepts up to three arguments.
761   * The function to be called for each element.
762   * @param { Object } [thisArg] - thisArg
763   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
764   * If thisArg is omitted, undefined is used as the this value.
765   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
766   * @throws { BusinessError } 401 - Parameter error. Possible causes:
767   * 1.Mandatory parameters are left unspecified;
768   * 2.Incorrect parameter types.
769   * @syscap SystemCapability.Utils.Lang
770   * @crossplatform
771   * @atomicservice
772   * @since 12
773   */
774  forEach(callbackFn: (value?: V, key?: K, map?: TreeMap<K, V>) => void, thisArg?: Object): void;
775
776  /**
777   * Executes the given callback function once for each real key in the map.
778   * It does not perform functions on deleted keys
779   *
780   * @param { TreeMapForEachCb<K, V> } callbackFn - callbackFn
781   * @syscap SystemCapability.Utils.Lang
782   * @crossplatform
783   * @atomicservice
784   * @since 20
785   * @arkts 1.2
786   */
787  forEach(callbackFn: TreeMapForEachCb<K, V>): void;
788
789  /**
790   * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
791   *
792   * @returns { IterableIterator<[K, V]> }
793   * @throws { BusinessError } 10200011 - The entries method cannot be bound.
794   * @syscap SystemCapability.Utils.Lang
795   * @since 8
796   */
797  /**
798   * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
799   *
800   * @returns { IterableIterator<[K, V]> }
801   * @throws { BusinessError } 10200011 - The entries method cannot be bound.
802   * @syscap SystemCapability.Utils.Lang
803   * @crossplatform
804   * @since 10
805   */
806  /**
807   * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
808   *
809   * @returns { IterableIterator<[K, V]> }
810   * @throws { BusinessError } 10200011 - The entries method cannot be bound.
811   * @syscap SystemCapability.Utils.Lang
812   * @crossplatform
813   * @atomicservice
814   * @since arkts {'1.1':'12', '1.2':'20'}
815   * @arkts 1.1&1.2
816   */
817  entries(): IterableIterator<[K, V]>;
818  /**
819   * returns an ES6 iterator.Each item of the iterator is a Javascript Object
820   *
821   * @returns { IterableIterator<[K, V]> }
822   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
823   * @syscap SystemCapability.Utils.Lang
824   * @since 8
825   */
826  /**
827   * returns an ES6 iterator.Each item of the iterator is a Javascript Object
828   *
829   * @returns { IterableIterator<[K, V]> }
830   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
831   * @syscap SystemCapability.Utils.Lang
832   * @crossplatform
833   * @since 10
834   */
835  /**
836   * returns an ES6 iterator.Each item of the iterator is a Javascript Object
837   *
838   * @returns { IterableIterator<[K, V]> }
839   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
840   * @syscap SystemCapability.Utils.Lang
841   * @crossplatform
842   * @atomicservice
843   * @since 12
844   */
845  [Symbol.iterator](): IterableIterator<[K, V]>;
846
847  /**
848   * returns an ES6 iterator.Each item of the iterator is a Javascript Object
849   *
850   * @returns { IterableIterator<[K, V]> } an iterator for the TreeMap
851   * @syscap SystemCapability.Utils.Lang
852   * @crossplatform
853   * @atomicservice
854   * @since 20
855   * @arkts 1.2
856   */
857  $_iterator(): IterableIterator<[K, V]>;
858
859}
860
861/**
862 * The type of TreeMap callback function.
863 *
864 * @typedef { function } TreeMapForEachCb
865 * @param { V } value - The value of current element
866 * @param { K } key - The key of current element
867 * @param { TreeMap<K, V> } map - The TreeMap instance being traversed
868 * @returns { void } This callback does not return a value
869 * @syscap SystemCapability.Utils.Lang
870 * @atomicservice
871 * @since 20
872 * @arkts 1.2
873 */
874type TreeMapForEachCb<K, V> = (value: V, key: K, map: TreeMap<K, V>) => void
875
876/**
877 * The type of TreeMap comparator.
878 *
879 * @typedef { function } TreeMapComparator
880 * @param { K } firstValue - The first value compared
881 * @param { K } secondValue - The second value compared
882 * @returns { number } - Comparison results
883 * @syscap SystemCapability.Utils.Lang
884 * @atomicservice
885 * @since 20
886 * @arkts 1.2
887 */
888type TreeMapComparator<K> = (firstValue: K, secondValue: K) => number
889
890export default TreeMap;
891