161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkTS 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value. 2361847f8eSopenharmony_ci * TreeMap is implemented using a red-black tree, which is a binary search tree where keys 2461847f8eSopenharmony_ci * are stored in sorted order for efficient insertion and removal. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 2761847f8eSopenharmony_ci * @since 8 2861847f8eSopenharmony_ci */ 2961847f8eSopenharmony_ci/** 3061847f8eSopenharmony_ci * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value. 3161847f8eSopenharmony_ci * TreeMap is implemented using a red-black tree, which is a binary search tree where keys 3261847f8eSopenharmony_ci * are stored in sorted order for efficient insertion and removal. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 3561847f8eSopenharmony_ci * @crossplatform 3661847f8eSopenharmony_ci * @since 10 3761847f8eSopenharmony_ci */ 3861847f8eSopenharmony_ci/** 3961847f8eSopenharmony_ci * TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value. 4061847f8eSopenharmony_ci * TreeMap is implemented using a red-black tree, which is a binary search tree where keys 4161847f8eSopenharmony_ci * are stored in sorted order for efficient insertion and removal. 4261847f8eSopenharmony_ci * 4361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 4461847f8eSopenharmony_ci * @crossplatform 4561847f8eSopenharmony_ci * @atomicservice 4661847f8eSopenharmony_ci * @since 12 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_cideclare class TreeMap<K, V> { 4961847f8eSopenharmony_ci /** 5061847f8eSopenharmony_ci * A constructor used to create a TreeMap object. 5161847f8eSopenharmony_ci * 5261847f8eSopenharmony_ci * @param { function } [comparator] - comparator 5361847f8eSopenharmony_ci * comparator (Optional) User-defined comparison functions. 5461847f8eSopenharmony_ci * firstValue (required) previous element. 5561847f8eSopenharmony_ci * secondValue (required) next element. 5661847f8eSopenharmony_ci * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked. 5761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 5861847f8eSopenharmony_ci * 1.Incorrect parameter types; 5961847f8eSopenharmony_ci * 2.Parameter verification failed. 6061847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 6161847f8eSopenharmony_ci * @since 8 6261847f8eSopenharmony_ci */ 6361847f8eSopenharmony_ci /** 6461847f8eSopenharmony_ci * A constructor used to create a TreeMap object. 6561847f8eSopenharmony_ci * 6661847f8eSopenharmony_ci * @param { function } [comparator] - comparator 6761847f8eSopenharmony_ci * comparator (Optional) User-defined comparison functions. 6861847f8eSopenharmony_ci * firstValue (required) previous element. 6961847f8eSopenharmony_ci * secondValue (required) next element. 7061847f8eSopenharmony_ci * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked. 7161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 7261847f8eSopenharmony_ci * 1.Incorrect parameter types; 7361847f8eSopenharmony_ci * 2.Parameter verification failed. 7461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 7561847f8eSopenharmony_ci * @crossplatform 7661847f8eSopenharmony_ci * @since 10 7761847f8eSopenharmony_ci */ 7861847f8eSopenharmony_ci /** 7961847f8eSopenharmony_ci * A constructor used to create a TreeMap object. 8061847f8eSopenharmony_ci * 8161847f8eSopenharmony_ci * @param { function } [comparator] - comparator 8261847f8eSopenharmony_ci * comparator (Optional) User-defined comparison functions. 8361847f8eSopenharmony_ci * firstValue (required) previous element. 8461847f8eSopenharmony_ci * secondValue (required) next element. 8561847f8eSopenharmony_ci * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked. 8661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 8761847f8eSopenharmony_ci * 1.Incorrect parameter types; 8861847f8eSopenharmony_ci * 2.Parameter verification failed. 8961847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 9061847f8eSopenharmony_ci * @crossplatform 9161847f8eSopenharmony_ci * @atomicservice 9261847f8eSopenharmony_ci * @since 12 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci constructor(comparator?: (firstValue: K, secondValue: K) => boolean); 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Gets the element number of the hashmap. 9761847f8eSopenharmony_ci * 9861847f8eSopenharmony_ci * @type { number } 9961847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 10061847f8eSopenharmony_ci * @since 8 10161847f8eSopenharmony_ci */ 10261847f8eSopenharmony_ci /** 10361847f8eSopenharmony_ci * Gets the element number of the hashmap. 10461847f8eSopenharmony_ci * 10561847f8eSopenharmony_ci * @type { number } 10661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 10761847f8eSopenharmony_ci * @crossplatform 10861847f8eSopenharmony_ci * @since 10 10961847f8eSopenharmony_ci */ 11061847f8eSopenharmony_ci /** 11161847f8eSopenharmony_ci * Gets the element number of the hashmap. 11261847f8eSopenharmony_ci * 11361847f8eSopenharmony_ci * @type { number } 11461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 11561847f8eSopenharmony_ci * @crossplatform 11661847f8eSopenharmony_ci * @atomicservice 11761847f8eSopenharmony_ci * @since 12 11861847f8eSopenharmony_ci */ 11961847f8eSopenharmony_ci length: number; 12061847f8eSopenharmony_ci /** 12161847f8eSopenharmony_ci * Returns whether the Map object contains elements 12261847f8eSopenharmony_ci * 12361847f8eSopenharmony_ci * @returns { boolean } the boolean type 12461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 12561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 12661847f8eSopenharmony_ci * @since 8 12761847f8eSopenharmony_ci */ 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * Returns whether the Map object contains elements 13061847f8eSopenharmony_ci * 13161847f8eSopenharmony_ci * @returns { boolean } the boolean type 13261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 13361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 13461847f8eSopenharmony_ci * @crossplatform 13561847f8eSopenharmony_ci * @since 10 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci /** 13861847f8eSopenharmony_ci * Returns whether the Map object contains elements 13961847f8eSopenharmony_ci * 14061847f8eSopenharmony_ci * @returns { boolean } the boolean type 14161847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 14261847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 14361847f8eSopenharmony_ci * @crossplatform 14461847f8eSopenharmony_ci * @atomicservice 14561847f8eSopenharmony_ci * @since 12 14661847f8eSopenharmony_ci */ 14761847f8eSopenharmony_ci isEmpty(): boolean; 14861847f8eSopenharmony_ci /** 14961847f8eSopenharmony_ci * Returns whether a key is contained in this map 15061847f8eSopenharmony_ci * 15161847f8eSopenharmony_ci * @param { K } key - key key need to determine whether to include the key 15261847f8eSopenharmony_ci * @returns { boolean } the boolean type 15361847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 15461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 15561847f8eSopenharmony_ci * @since 8 15661847f8eSopenharmony_ci */ 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * Returns whether a key is contained in this map 15961847f8eSopenharmony_ci * 16061847f8eSopenharmony_ci * @param { K } key - key key need to determine whether to include the key 16161847f8eSopenharmony_ci * @returns { boolean } the boolean type 16261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 16361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 16461847f8eSopenharmony_ci * @crossplatform 16561847f8eSopenharmony_ci * @since 10 16661847f8eSopenharmony_ci */ 16761847f8eSopenharmony_ci /** 16861847f8eSopenharmony_ci * Returns whether a key is contained in this map 16961847f8eSopenharmony_ci * 17061847f8eSopenharmony_ci * @param { K } key - key key need to determine whether to include the key 17161847f8eSopenharmony_ci * @returns { boolean } the boolean type 17261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 17361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 17461847f8eSopenharmony_ci * @crossplatform 17561847f8eSopenharmony_ci * @atomicservice 17661847f8eSopenharmony_ci * @since 12 17761847f8eSopenharmony_ci */ 17861847f8eSopenharmony_ci hasKey(key: K): boolean; 17961847f8eSopenharmony_ci /** 18061847f8eSopenharmony_ci * Returns whether a value is contained in this map 18161847f8eSopenharmony_ci * 18261847f8eSopenharmony_ci * @param { V } value - value value value need to determine whether to include the value 18361847f8eSopenharmony_ci * @returns { boolean } the boolean type 18461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 18561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 18661847f8eSopenharmony_ci * @since 8 18761847f8eSopenharmony_ci */ 18861847f8eSopenharmony_ci /** 18961847f8eSopenharmony_ci * Returns whether a value is contained in this map 19061847f8eSopenharmony_ci * 19161847f8eSopenharmony_ci * @param { V } value - value value value need to determine whether to include the value 19261847f8eSopenharmony_ci * @returns { boolean } the boolean type 19361847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 19461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 19561847f8eSopenharmony_ci * @crossplatform 19661847f8eSopenharmony_ci * @since 10 19761847f8eSopenharmony_ci */ 19861847f8eSopenharmony_ci /** 19961847f8eSopenharmony_ci * Returns whether a value is contained in this map 20061847f8eSopenharmony_ci * 20161847f8eSopenharmony_ci * @param { V } value - value value value need to determine whether to include the value 20261847f8eSopenharmony_ci * @returns { boolean } the boolean type 20361847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 20461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 20561847f8eSopenharmony_ci * @crossplatform 20661847f8eSopenharmony_ci * @atomicservice 20761847f8eSopenharmony_ci * @since 12 20861847f8eSopenharmony_ci */ 20961847f8eSopenharmony_ci hasValue(value: V): boolean; 21061847f8eSopenharmony_ci /** 21161847f8eSopenharmony_ci * Returns a specified element in a Map object, or undefined if there is no corresponding element 21261847f8eSopenharmony_ci * 21361847f8eSopenharmony_ci * @param { K } key - key key the index in TreeMap 21461847f8eSopenharmony_ci * @returns { V } value or undefined 21561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The get method cannot be bound. 21661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 21761847f8eSopenharmony_ci * @since 8 21861847f8eSopenharmony_ci */ 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * Returns a specified element in a Map object, or undefined if there is no corresponding element 22161847f8eSopenharmony_ci * 22261847f8eSopenharmony_ci * @param { K } key - key key the index in TreeMap 22361847f8eSopenharmony_ci * @returns { V } value or undefined 22461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The get method cannot be bound. 22561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 22661847f8eSopenharmony_ci * @crossplatform 22761847f8eSopenharmony_ci * @since 10 22861847f8eSopenharmony_ci */ 22961847f8eSopenharmony_ci /** 23061847f8eSopenharmony_ci * Returns a specified element in a Map object, or undefined if there is no corresponding element 23161847f8eSopenharmony_ci * 23261847f8eSopenharmony_ci * @param { K } key - key key the index in TreeMap 23361847f8eSopenharmony_ci * @returns { V } value or undefined 23461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The get method cannot be bound. 23561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 23661847f8eSopenharmony_ci * @crossplatform 23761847f8eSopenharmony_ci * @atomicservice 23861847f8eSopenharmony_ci * @since 12 23961847f8eSopenharmony_ci */ 24061847f8eSopenharmony_ci get(key: K): V; 24161847f8eSopenharmony_ci /** 24261847f8eSopenharmony_ci * Obtains the first sorted key in the treemap. 24361847f8eSopenharmony_ci * Or returns undefined if tree map is empty 24461847f8eSopenharmony_ci * 24561847f8eSopenharmony_ci * @returns { K } value or undefined 24661847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound. 24761847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 24861847f8eSopenharmony_ci * @since 8 24961847f8eSopenharmony_ci */ 25061847f8eSopenharmony_ci /** 25161847f8eSopenharmony_ci * Obtains the first sorted key in the treemap. 25261847f8eSopenharmony_ci * Or returns undefined if tree map is empty 25361847f8eSopenharmony_ci * 25461847f8eSopenharmony_ci * @returns { K } value or undefined 25561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound. 25661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 25761847f8eSopenharmony_ci * @crossplatform 25861847f8eSopenharmony_ci * @since 10 25961847f8eSopenharmony_ci */ 26061847f8eSopenharmony_ci /** 26161847f8eSopenharmony_ci * Obtains the first sorted key in the treemap. 26261847f8eSopenharmony_ci * Or returns undefined if tree map is empty 26361847f8eSopenharmony_ci * 26461847f8eSopenharmony_ci * @returns { K } value or undefined 26561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound. 26661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 26761847f8eSopenharmony_ci * @crossplatform 26861847f8eSopenharmony_ci * @atomicservice 26961847f8eSopenharmony_ci * @since 12 27061847f8eSopenharmony_ci */ 27161847f8eSopenharmony_ci getFirstKey(): K; 27261847f8eSopenharmony_ci /** 27361847f8eSopenharmony_ci * Obtains the last sorted key in the treemap. 27461847f8eSopenharmony_ci * Or returns undefined if tree map is empty 27561847f8eSopenharmony_ci * 27661847f8eSopenharmony_ci * @returns { K } value or undefined 27761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound. 27861847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 27961847f8eSopenharmony_ci * @since 8 28061847f8eSopenharmony_ci */ 28161847f8eSopenharmony_ci /** 28261847f8eSopenharmony_ci * Obtains the last sorted key in the treemap. 28361847f8eSopenharmony_ci * Or returns undefined if tree map is empty 28461847f8eSopenharmony_ci * 28561847f8eSopenharmony_ci * @returns { K } value or undefined 28661847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound. 28761847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 28861847f8eSopenharmony_ci * @crossplatform 28961847f8eSopenharmony_ci * @since 10 29061847f8eSopenharmony_ci */ 29161847f8eSopenharmony_ci /** 29261847f8eSopenharmony_ci * Obtains the last sorted key in the treemap. 29361847f8eSopenharmony_ci * Or returns undefined if tree map is empty 29461847f8eSopenharmony_ci * 29561847f8eSopenharmony_ci * @returns { K } value or undefined 29661847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound. 29761847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 29861847f8eSopenharmony_ci * @crossplatform 29961847f8eSopenharmony_ci * @atomicservice 30061847f8eSopenharmony_ci * @since 12 30161847f8eSopenharmony_ci */ 30261847f8eSopenharmony_ci getLastKey(): K; 30361847f8eSopenharmony_ci /** 30461847f8eSopenharmony_ci * Adds all element groups in one map to another map 30561847f8eSopenharmony_ci * 30661847f8eSopenharmony_ci * @param { TreeMap<K, V> } map - map map the Map object to add members 30761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 30861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 30961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 31061847f8eSopenharmony_ci * 2.Incorrect parameter types. 31161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 31261847f8eSopenharmony_ci * @since 8 31361847f8eSopenharmony_ci */ 31461847f8eSopenharmony_ci /** 31561847f8eSopenharmony_ci * Adds all element groups in one map to another map 31661847f8eSopenharmony_ci * 31761847f8eSopenharmony_ci * @param { TreeMap<K, V> } map - map map the Map object to add members 31861847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 31961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 32061847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 32161847f8eSopenharmony_ci * 2.Incorrect parameter types. 32261847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 32361847f8eSopenharmony_ci * @crossplatform 32461847f8eSopenharmony_ci * @since 10 32561847f8eSopenharmony_ci */ 32661847f8eSopenharmony_ci /** 32761847f8eSopenharmony_ci * Adds all element groups in one map to another map 32861847f8eSopenharmony_ci * 32961847f8eSopenharmony_ci * @param { TreeMap<K, V> } map - map map the Map object to add members 33061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 33161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 33261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 33361847f8eSopenharmony_ci * 2.Incorrect parameter types. 33461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 33561847f8eSopenharmony_ci * @crossplatform 33661847f8eSopenharmony_ci * @atomicservice 33761847f8eSopenharmony_ci * @since 12 33861847f8eSopenharmony_ci */ 33961847f8eSopenharmony_ci setAll(map: TreeMap<K, V>): void; 34061847f8eSopenharmony_ci /** 34161847f8eSopenharmony_ci * Adds or updates a(new) key-value pair with a key and value specified for the Map object 34261847f8eSopenharmony_ci * 34361847f8eSopenharmony_ci * @param { K } key - key key Added or updated targets 34461847f8eSopenharmony_ci * @param { V } value - value value Added or updated value 34561847f8eSopenharmony_ci * @returns { Object } the map object after set 34661847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The set method cannot be bound. 34761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 34861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 34961847f8eSopenharmony_ci * 2.Incorrect parameter types; 35061847f8eSopenharmony_ci * 3.Parameter verification failed. 35161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 35261847f8eSopenharmony_ci * @since 8 35361847f8eSopenharmony_ci */ 35461847f8eSopenharmony_ci /** 35561847f8eSopenharmony_ci * Adds or updates a(new) key-value pair with a key and value specified for the Map object 35661847f8eSopenharmony_ci * 35761847f8eSopenharmony_ci * @param { K } key - key key Added or updated targets 35861847f8eSopenharmony_ci * @param { V } value - value value Added or updated value 35961847f8eSopenharmony_ci * @returns { Object } the map object after set 36061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The set method cannot be bound. 36161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 36261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 36361847f8eSopenharmony_ci * 2.Incorrect parameter types; 36461847f8eSopenharmony_ci * 3.Parameter verification failed. 36561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 36661847f8eSopenharmony_ci * @crossplatform 36761847f8eSopenharmony_ci * @since 10 36861847f8eSopenharmony_ci */ 36961847f8eSopenharmony_ci /** 37061847f8eSopenharmony_ci * Adds or updates a(new) key-value pair with a key and value specified for the Map object 37161847f8eSopenharmony_ci * 37261847f8eSopenharmony_ci * @param { K } key - key key Added or updated targets 37361847f8eSopenharmony_ci * @param { V } value - value value Added or updated value 37461847f8eSopenharmony_ci * @returns { Object } the map object after set 37561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The set method cannot be bound. 37661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 37761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 37861847f8eSopenharmony_ci * 2.Incorrect parameter types; 37961847f8eSopenharmony_ci * 3.Parameter verification failed. 38061847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 38161847f8eSopenharmony_ci * @crossplatform 38261847f8eSopenharmony_ci * @atomicservice 38361847f8eSopenharmony_ci * @since 12 38461847f8eSopenharmony_ci */ 38561847f8eSopenharmony_ci set(key: K, value: V): Object; 38661847f8eSopenharmony_ci /** 38761847f8eSopenharmony_ci * Remove a specified element from a Map object 38861847f8eSopenharmony_ci * 38961847f8eSopenharmony_ci * @param { K } key - key key Target to be deleted 39061847f8eSopenharmony_ci * @returns { V } Target mapped value 39161847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The remove method cannot be bound. 39261847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 39361847f8eSopenharmony_ci * @since 8 39461847f8eSopenharmony_ci */ 39561847f8eSopenharmony_ci /** 39661847f8eSopenharmony_ci * Remove a specified element from a Map object 39761847f8eSopenharmony_ci * 39861847f8eSopenharmony_ci * @param { K } key - key key Target to be deleted 39961847f8eSopenharmony_ci * @returns { V } Target mapped value 40061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The remove method cannot be bound. 40161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 40261847f8eSopenharmony_ci * @crossplatform 40361847f8eSopenharmony_ci * @since 10 40461847f8eSopenharmony_ci */ 40561847f8eSopenharmony_ci /** 40661847f8eSopenharmony_ci * Remove a specified element from a Map object 40761847f8eSopenharmony_ci * 40861847f8eSopenharmony_ci * @param { K } key - key key Target to be deleted 40961847f8eSopenharmony_ci * @returns { V } Target mapped value 41061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The remove method cannot be bound. 41161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 41261847f8eSopenharmony_ci * @crossplatform 41361847f8eSopenharmony_ci * @atomicservice 41461847f8eSopenharmony_ci * @since 12 41561847f8eSopenharmony_ci */ 41661847f8eSopenharmony_ci remove(key: K): V; 41761847f8eSopenharmony_ci /** 41861847f8eSopenharmony_ci * Clear all element groups in the map 41961847f8eSopenharmony_ci * 42061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The clear method cannot be bound. 42161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 42261847f8eSopenharmony_ci * @since 8 42361847f8eSopenharmony_ci */ 42461847f8eSopenharmony_ci /** 42561847f8eSopenharmony_ci * Clear all element groups in the map 42661847f8eSopenharmony_ci * 42761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The clear method cannot be bound. 42861847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 42961847f8eSopenharmony_ci * @crossplatform 43061847f8eSopenharmony_ci * @since 10 43161847f8eSopenharmony_ci */ 43261847f8eSopenharmony_ci /** 43361847f8eSopenharmony_ci * Clear all element groups in the map 43461847f8eSopenharmony_ci * 43561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The clear method cannot be bound. 43661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 43761847f8eSopenharmony_ci * @crossplatform 43861847f8eSopenharmony_ci * @atomicservice 43961847f8eSopenharmony_ci * @since 12 44061847f8eSopenharmony_ci */ 44161847f8eSopenharmony_ci clear(): void; 44261847f8eSopenharmony_ci /** 44361847f8eSopenharmony_ci * Returns the greatest element smaller than or equal to the specified key 44461847f8eSopenharmony_ci * if the key does not exist, undefined is returned 44561847f8eSopenharmony_ci * 44661847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 44761847f8eSopenharmony_ci * @returns { K } key or undefined 44861847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound. 44961847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 45061847f8eSopenharmony_ci * @since 8 45161847f8eSopenharmony_ci */ 45261847f8eSopenharmony_ci /** 45361847f8eSopenharmony_ci * Returns the greatest element smaller than or equal to the specified key 45461847f8eSopenharmony_ci * if the key does not exist, undefined is returned 45561847f8eSopenharmony_ci * 45661847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 45761847f8eSopenharmony_ci * @returns { K } key or undefined 45861847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound. 45961847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 46061847f8eSopenharmony_ci * @crossplatform 46161847f8eSopenharmony_ci * @since 10 46261847f8eSopenharmony_ci */ 46361847f8eSopenharmony_ci /** 46461847f8eSopenharmony_ci * Returns the greatest element smaller than or equal to the specified key 46561847f8eSopenharmony_ci * if the key does not exist, undefined is returned 46661847f8eSopenharmony_ci * 46761847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 46861847f8eSopenharmony_ci * @returns { K } key or undefined 46961847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound. 47061847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 47161847f8eSopenharmony_ci * @crossplatform 47261847f8eSopenharmony_ci * @atomicservice 47361847f8eSopenharmony_ci * @since 12 47461847f8eSopenharmony_ci */ 47561847f8eSopenharmony_ci getLowerKey(key: K): K; 47661847f8eSopenharmony_ci /** 47761847f8eSopenharmony_ci * Returns the least element greater than or equal to the specified key 47861847f8eSopenharmony_ci * if the key does not exist, undefined is returned 47961847f8eSopenharmony_ci * 48061847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 48161847f8eSopenharmony_ci * @returns { K } key or undefined 48261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound. 48361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 48461847f8eSopenharmony_ci * @since 8 48561847f8eSopenharmony_ci */ 48661847f8eSopenharmony_ci /** 48761847f8eSopenharmony_ci * Returns the least element greater than or equal to the specified key 48861847f8eSopenharmony_ci * if the key does not exist, undefined is returned 48961847f8eSopenharmony_ci * 49061847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 49161847f8eSopenharmony_ci * @returns { K } key or undefined 49261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound. 49361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 49461847f8eSopenharmony_ci * @crossplatform 49561847f8eSopenharmony_ci * @since 10 49661847f8eSopenharmony_ci */ 49761847f8eSopenharmony_ci /** 49861847f8eSopenharmony_ci * Returns the least element greater than or equal to the specified key 49961847f8eSopenharmony_ci * if the key does not exist, undefined is returned 50061847f8eSopenharmony_ci * 50161847f8eSopenharmony_ci * @param { K } key - key key Objective of comparison 50261847f8eSopenharmony_ci * @returns { K } key or undefined 50361847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound. 50461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 50561847f8eSopenharmony_ci * @crossplatform 50661847f8eSopenharmony_ci * @atomicservice 50761847f8eSopenharmony_ci * @since 12 50861847f8eSopenharmony_ci */ 50961847f8eSopenharmony_ci getHigherKey(key: K): K; 51061847f8eSopenharmony_ci /** 51161847f8eSopenharmony_ci * Returns a new Iterator object that contains the keys contained in this map 51261847f8eSopenharmony_ci * 51361847f8eSopenharmony_ci * @returns { IterableIterator<K> } 51461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The keys method cannot be bound. 51561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 51661847f8eSopenharmony_ci * @since 8 51761847f8eSopenharmony_ci */ 51861847f8eSopenharmony_ci /** 51961847f8eSopenharmony_ci * Returns a new Iterator object that contains the keys contained in this map 52061847f8eSopenharmony_ci * 52161847f8eSopenharmony_ci * @returns { IterableIterator<K> } 52261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The keys method cannot be bound. 52361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 52461847f8eSopenharmony_ci * @crossplatform 52561847f8eSopenharmony_ci * @since 10 52661847f8eSopenharmony_ci */ 52761847f8eSopenharmony_ci /** 52861847f8eSopenharmony_ci * Returns a new Iterator object that contains the keys contained in this map 52961847f8eSopenharmony_ci * 53061847f8eSopenharmony_ci * @returns { IterableIterator<K> } 53161847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The keys method cannot be bound. 53261847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 53361847f8eSopenharmony_ci * @crossplatform 53461847f8eSopenharmony_ci * @atomicservice 53561847f8eSopenharmony_ci * @since 12 53661847f8eSopenharmony_ci */ 53761847f8eSopenharmony_ci keys(): IterableIterator<K>; 53861847f8eSopenharmony_ci /** 53961847f8eSopenharmony_ci * Returns a new Iterator object that contains the values contained in this map 54061847f8eSopenharmony_ci * 54161847f8eSopenharmony_ci * @returns { IterableIterator<V> } 54261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The values method cannot be bound. 54361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 54461847f8eSopenharmony_ci * @since 8 54561847f8eSopenharmony_ci */ 54661847f8eSopenharmony_ci /** 54761847f8eSopenharmony_ci * Returns a new Iterator object that contains the values contained in this map 54861847f8eSopenharmony_ci * 54961847f8eSopenharmony_ci * @returns { IterableIterator<V> } 55061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The values method cannot be bound. 55161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 55261847f8eSopenharmony_ci * @crossplatform 55361847f8eSopenharmony_ci * @since 10 55461847f8eSopenharmony_ci */ 55561847f8eSopenharmony_ci /** 55661847f8eSopenharmony_ci * Returns a new Iterator object that contains the values contained in this map 55761847f8eSopenharmony_ci * 55861847f8eSopenharmony_ci * @returns { IterableIterator<V> } 55961847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The values method cannot be bound. 56061847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 56161847f8eSopenharmony_ci * @crossplatform 56261847f8eSopenharmony_ci * @atomicservice 56361847f8eSopenharmony_ci * @since 12 56461847f8eSopenharmony_ci */ 56561847f8eSopenharmony_ci values(): IterableIterator<V>; 56661847f8eSopenharmony_ci /** 56761847f8eSopenharmony_ci * Replace the old value by new value corresponding to the specified key 56861847f8eSopenharmony_ci * 56961847f8eSopenharmony_ci * @param { K } key - key key Updated targets 57061847f8eSopenharmony_ci * @param { V } newValue - newValue newValue Updated the target mapped value 57161847f8eSopenharmony_ci * @returns { boolean } the boolean type(Is there a target pointed to by the key) 57261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The replace method cannot be bound. 57361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 57461847f8eSopenharmony_ci * @since 8 57561847f8eSopenharmony_ci */ 57661847f8eSopenharmony_ci /** 57761847f8eSopenharmony_ci * Replace the old value by new value corresponding to the specified key 57861847f8eSopenharmony_ci * 57961847f8eSopenharmony_ci * @param { K } key - key key Updated targets 58061847f8eSopenharmony_ci * @param { V } newValue - newValue newValue Updated the target mapped value 58161847f8eSopenharmony_ci * @returns { boolean } the boolean type(Is there a target pointed to by the key) 58261847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The replace method cannot be bound. 58361847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 58461847f8eSopenharmony_ci * @crossplatform 58561847f8eSopenharmony_ci * @since 10 58661847f8eSopenharmony_ci */ 58761847f8eSopenharmony_ci /** 58861847f8eSopenharmony_ci * Replace the old value by new value corresponding to the specified key 58961847f8eSopenharmony_ci * 59061847f8eSopenharmony_ci * @param { K } key - key key Updated targets 59161847f8eSopenharmony_ci * @param { V } newValue - newValue newValue Updated the target mapped value 59261847f8eSopenharmony_ci * @returns { boolean } the boolean type(Is there a target pointed to by the key) 59361847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The replace method cannot be bound. 59461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 59561847f8eSopenharmony_ci * @crossplatform 59661847f8eSopenharmony_ci * @atomicservice 59761847f8eSopenharmony_ci * @since 12 59861847f8eSopenharmony_ci */ 59961847f8eSopenharmony_ci replace(key: K, newValue: V): boolean; 60061847f8eSopenharmony_ci /** 60161847f8eSopenharmony_ci * Executes the given callback function once for each real key in the map. 60261847f8eSopenharmony_ci * It does not perform functions on deleted keys 60361847f8eSopenharmony_ci * 60461847f8eSopenharmony_ci * @param { function } callbackFn - callbackFn 60561847f8eSopenharmony_ci * callbackFn (required) A function that accepts up to three arguments. 60661847f8eSopenharmony_ci * The function to be called for each element. 60761847f8eSopenharmony_ci * @param { Object } [thisArg] - thisArg 60861847f8eSopenharmony_ci * thisArg (Optional) The value to be used as this value for when callbackFn is called. 60961847f8eSopenharmony_ci * If thisArg is omitted, undefined is used as the this value. 61061847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 61161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 61261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 61361847f8eSopenharmony_ci * 2.Incorrect parameter types. 61461847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 61561847f8eSopenharmony_ci * @since 8 61661847f8eSopenharmony_ci */ 61761847f8eSopenharmony_ci /** 61861847f8eSopenharmony_ci * Executes the given callback function once for each real key in the map. 61961847f8eSopenharmony_ci * It does not perform functions on deleted keys 62061847f8eSopenharmony_ci * 62161847f8eSopenharmony_ci * @param { function } callbackFn - callbackFn 62261847f8eSopenharmony_ci * callbackFn (required) A function that accepts up to three arguments. 62361847f8eSopenharmony_ci * The function to be called for each element. 62461847f8eSopenharmony_ci * @param { Object } [thisArg] - thisArg 62561847f8eSopenharmony_ci * thisArg (Optional) The value to be used as this value for when callbackFn is called. 62661847f8eSopenharmony_ci * If thisArg is omitted, undefined is used as the this value. 62761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 62861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 62961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 63061847f8eSopenharmony_ci * 2.Incorrect parameter types. 63161847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 63261847f8eSopenharmony_ci * @crossplatform 63361847f8eSopenharmony_ci * @since 10 63461847f8eSopenharmony_ci */ 63561847f8eSopenharmony_ci /** 63661847f8eSopenharmony_ci * Executes the given callback function once for each real key in the map. 63761847f8eSopenharmony_ci * It does not perform functions on deleted keys 63861847f8eSopenharmony_ci * 63961847f8eSopenharmony_ci * @param { function } callbackFn - callbackFn 64061847f8eSopenharmony_ci * callbackFn (required) A function that accepts up to three arguments. 64161847f8eSopenharmony_ci * The function to be called for each element. 64261847f8eSopenharmony_ci * @param { Object } [thisArg] - thisArg 64361847f8eSopenharmony_ci * thisArg (Optional) The value to be used as this value for when callbackFn is called. 64461847f8eSopenharmony_ci * If thisArg is omitted, undefined is used as the this value. 64561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 64661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 64761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 64861847f8eSopenharmony_ci * 2.Incorrect parameter types. 64961847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 65061847f8eSopenharmony_ci * @crossplatform 65161847f8eSopenharmony_ci * @atomicservice 65261847f8eSopenharmony_ci * @since 12 65361847f8eSopenharmony_ci */ 65461847f8eSopenharmony_ci forEach(callbackFn: (value?: V, key?: K, map?: TreeMap<K, V>) => void, thisArg?: Object): void; 65561847f8eSopenharmony_ci /** 65661847f8eSopenharmony_ci * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 65761847f8eSopenharmony_ci * 65861847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 65961847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The entries method cannot be bound. 66061847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 66161847f8eSopenharmony_ci * @since 8 66261847f8eSopenharmony_ci */ 66361847f8eSopenharmony_ci /** 66461847f8eSopenharmony_ci * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 66561847f8eSopenharmony_ci * 66661847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 66761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The entries method cannot be bound. 66861847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 66961847f8eSopenharmony_ci * @crossplatform 67061847f8eSopenharmony_ci * @since 10 67161847f8eSopenharmony_ci */ 67261847f8eSopenharmony_ci /** 67361847f8eSopenharmony_ci * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 67461847f8eSopenharmony_ci * 67561847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 67661847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The entries method cannot be bound. 67761847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 67861847f8eSopenharmony_ci * @crossplatform 67961847f8eSopenharmony_ci * @atomicservice 68061847f8eSopenharmony_ci * @since 12 68161847f8eSopenharmony_ci */ 68261847f8eSopenharmony_ci entries(): IterableIterator<[K, V]>; 68361847f8eSopenharmony_ci /** 68461847f8eSopenharmony_ci * returns an ES6 iterator.Each item of the iterator is a Javascript Object 68561847f8eSopenharmony_ci * 68661847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 68761847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 68861847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 68961847f8eSopenharmony_ci * @since 8 69061847f8eSopenharmony_ci */ 69161847f8eSopenharmony_ci /** 69261847f8eSopenharmony_ci * returns an ES6 iterator.Each item of the iterator is a Javascript Object 69361847f8eSopenharmony_ci * 69461847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 69561847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 69661847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 69761847f8eSopenharmony_ci * @crossplatform 69861847f8eSopenharmony_ci * @since 10 69961847f8eSopenharmony_ci */ 70061847f8eSopenharmony_ci /** 70161847f8eSopenharmony_ci * returns an ES6 iterator.Each item of the iterator is a Javascript Object 70261847f8eSopenharmony_ci * 70361847f8eSopenharmony_ci * @returns { IterableIterator<[K, V]> } 70461847f8eSopenharmony_ci * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 70561847f8eSopenharmony_ci * @syscap SystemCapability.Utils.Lang 70661847f8eSopenharmony_ci * @crossplatform 70761847f8eSopenharmony_ci * @atomicservice 70861847f8eSopenharmony_ci * @since 12 70961847f8eSopenharmony_ci */ 71061847f8eSopenharmony_ci [Symbol.iterator](): IterableIterator<[K, V]>; 71161847f8eSopenharmony_ci} 71261847f8eSopenharmony_ci 71361847f8eSopenharmony_ciexport default TreeMap; 714