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 * LightWeightMap stores key-value (KV) pairs. Each key must be unique and have only one value. 23 * 24 * @syscap SystemCapability.Utils.Lang 25 * @since 8 26 */ 27/** 28 * LightWeightMap stores key-value (KV) pairs. Each key must be unique and have only one value. 29 * 30 * @syscap SystemCapability.Utils.Lang 31 * @crossplatform 32 * @since 10 33 */ 34/** 35 * LightWeightMap stores key-value (KV) pairs. Each key must be unique and have only one value. 36 * 37 * @syscap SystemCapability.Utils.Lang 38 * @crossplatform 39 * @atomicservice 40 * @since arkts {'1.1':'12', '1.2':'20'} 41 * @arkts 1.1&1.2 42 */ 43declare class LightWeightMap<K, V> { 44 /** 45 * A constructor used to create a LightWeightMap object. 46 * 47 * @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked. 48 * @syscap SystemCapability.Utils.Lang 49 * @since 8 50 */ 51 /** 52 * A constructor used to create a LightWeightMap object. 53 * 54 * @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked. 55 * @syscap SystemCapability.Utils.Lang 56 * @crossplatform 57 * @since 10 58 */ 59 /** 60 * A constructor used to create a LightWeightMap object. 61 * 62 * @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked. 63 * @syscap SystemCapability.Utils.Lang 64 * @crossplatform 65 * @atomicservice 66 * @since arkts {'1.1':'12', '1.2':'20'} 67 * @arkts 1.1&1.2 68 */ 69 constructor(); 70 /** 71 * Gets the element number of the LightWeightMap. 72 * 73 * @type { number } 74 * @syscap SystemCapability.Utils.Lang 75 * @since 8 76 */ 77 /** 78 * Gets the element number of the LightWeightMap. 79 * 80 * @type { number } 81 * @syscap SystemCapability.Utils.Lang 82 * @crossplatform 83 * @since 10 84 */ 85 /** 86 * Gets the element number of the LightWeightMap. 87 * 88 * @type { number } 89 * @syscap SystemCapability.Utils.Lang 90 * @crossplatform 91 * @atomicservice 92 * @since 12 93 */ 94 length: number; 95 /** 96 * Gets the element number of the LightWeightMap. 97 * 98 * @type { number } 99 * @syscap SystemCapability.Utils.Lang 100 * @crossplatform 101 * @atomicservice 102 * @since 20 103 * @arkts 1.2 104 */ 105 get length(): number; 106 /** 107 * Returns whether this map has all the object in a specified map 108 * 109 * @param { LightWeightMap<K, V> } map - map map the Map object to compare 110 * @returns { boolean } the boolean type 111 * @throws { BusinessError } 401 - Parameter error. Possible causes: 112 * 1.Mandatory parameters are left unspecified; 113 * 2.Incorrect parameter types. 114 * @throws { BusinessError } 10200011 - The hasAll method cannot be bound. 115 * @syscap SystemCapability.Utils.Lang 116 * @since 8 117 */ 118 /** 119 * Returns whether this map has all the object in a specified map 120 * 121 * @param { LightWeightMap<K, V> } map - map map the Map object to compare 122 * @returns { boolean } the boolean type 123 * @throws { BusinessError } 401 - Parameter error. Possible causes: 124 * 1.Mandatory parameters are left unspecified; 125 * 2.Incorrect parameter types. 126 * @throws { BusinessError } 10200011 - The hasAll method cannot be bound. 127 * @syscap SystemCapability.Utils.Lang 128 * @crossplatform 129 * @since 10 130 */ 131 /** 132 * Returns whether this map has all the object in a specified map 133 * 134 * @param { LightWeightMap<K, V> } map - map map the Map object to compare 135 * @returns { boolean } the boolean type 136 * @throws { BusinessError } 401 - Parameter error. Possible causes: 137 * 1.Mandatory parameters are left unspecified; 138 * 2.Incorrect parameter types. 139 * @throws { BusinessError } 10200011 - The hasAll method cannot be bound. 140 * @syscap SystemCapability.Utils.Lang 141 * @crossplatform 142 * @atomicservice 143 * @since arkts {'1.1':'12', '1.2':'20'} 144 * @arkts 1.1&1.2 145 */ 146 hasAll(map: LightWeightMap<K, V>): boolean; 147 /** 148 * Returns whether a key is contained in this map 149 * 150 * @param { K } key - key key need to determine whether to include the key 151 * @returns { boolean } the boolean type 152 * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 153 * @syscap SystemCapability.Utils.Lang 154 * @since 8 155 */ 156 /** 157 * Returns whether a key is contained in this map 158 * 159 * @param { K } key - key key need to determine whether to include the key 160 * @returns { boolean } the boolean type 161 * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 162 * @syscap SystemCapability.Utils.Lang 163 * @crossplatform 164 * @since 10 165 */ 166 /** 167 * Returns whether a key is contained in this map 168 * 169 * @param { K } key - key key need to determine whether to include the key 170 * @returns { boolean } the boolean type 171 * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. 172 * @syscap SystemCapability.Utils.Lang 173 * @crossplatform 174 * @atomicservice 175 * @since arkts {'1.1':'12', '1.2':'20'} 176 * @arkts 1.1&1.2 177 */ 178 hasKey(key: K): boolean; 179 /** 180 * Returns whether a value is contained in this map 181 * 182 * @param { V } value - value value need to determine whether to include the value 183 * @returns { boolean } the boolean type 184 * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 185 * @syscap SystemCapability.Utils.Lang 186 * @since 8 187 */ 188 /** 189 * Returns whether a value is contained in this map 190 * 191 * @param { V } value - value value need to determine whether to include the value 192 * @returns { boolean } the boolean type 193 * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 194 * @syscap SystemCapability.Utils.Lang 195 * @crossplatform 196 * @since 10 197 */ 198 /** 199 * Returns whether a value is contained in this map 200 * 201 * @param { V } value - value value need to determine whether to include the value 202 * @returns { boolean } the boolean type 203 * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. 204 * @syscap SystemCapability.Utils.Lang 205 * @crossplatform 206 * @atomicservice 207 * @since arkts {'1.1':'12', '1.2':'20'} 208 * @arkts 1.1&1.2 209 */ 210 hasValue(value: V): boolean; 211 /** 212 * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, 213 * and that the container has all the original objects after capacity expansion 214 * 215 * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved 216 * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. 217 * @throws { BusinessError } 401 - Parameter error. Possible causes: 218 * 1.Mandatory parameters are left unspecified; 219 * 2.Incorrect parameter types. 220 * @syscap SystemCapability.Utils.Lang 221 * @since 8 222 */ 223 /** 224 * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, 225 * and that the container has all the original objects after capacity expansion 226 * 227 * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved 228 * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. 229 * @throws { BusinessError } 401 - Parameter error. Possible causes: 230 * 1.Mandatory parameters are left unspecified; 231 * 2.Incorrect parameter types. 232 * @syscap SystemCapability.Utils.Lang 233 * @crossplatform 234 * @since 10 235 */ 236 /** 237 * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, 238 * and that the container has all the original objects after capacity expansion 239 * 240 * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved 241 * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. 242 * @throws { BusinessError } 401 - Parameter error. Possible causes: 243 * 1.Mandatory parameters are left unspecified; 244 * 2.Incorrect parameter types. 245 * @syscap SystemCapability.Utils.Lang 246 * @crossplatform 247 * @atomicservice 248 * @since arkts {'1.1':'12', '1.2':'20'} 249 * @arkts 1.1&1.2 250 */ 251 increaseCapacityTo(minimumCapacity: number): void; 252 /** 253 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 254 * 255 * @returns { IterableIterator<[K, V]> } 256 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 257 * @syscap SystemCapability.Utils.Lang 258 * @since 8 259 */ 260 /** 261 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 262 * 263 * @returns { IterableIterator<[K, V]> } 264 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 265 * @syscap SystemCapability.Utils.Lang 266 * @crossplatform 267 * @since 10 268 */ 269 /** 270 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order 271 * 272 * @returns { IterableIterator<[K, V]> } 273 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 274 * @syscap SystemCapability.Utils.Lang 275 * @crossplatform 276 * @atomicservice 277 * @since arkts {'1.1':'12', '1.2':'20'} 278 * @arkts 1.1&1.2 279 */ 280 entries(): IterableIterator<[K, V]>; 281 /** 282 * Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key 283 * 284 * @param { K } key - key key the index in LightWeightMap 285 * @returns { V } value or undefined 286 * @throws { BusinessError } 10200011 - The get method cannot be bound. 287 * @syscap SystemCapability.Utils.Lang 288 * @since 8 289 */ 290 /** 291 * Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key 292 * 293 * @param { K } key - key key the index in LightWeightMap 294 * @returns { V } value or undefined 295 * @throws { BusinessError } 10200011 - The get method cannot be bound. 296 * @syscap SystemCapability.Utils.Lang 297 * @crossplatform 298 * @since 10 299 */ 300 /** 301 * Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key 302 * 303 * @param { K } key - key key the index in LightWeightMap 304 * @returns { V } value or undefined 305 * @throws { BusinessError } 10200011 - The get method cannot be bound. 306 * @syscap SystemCapability.Utils.Lang 307 * @crossplatform 308 * @atomicservice 309 * @since 12 310 */ 311 get(key: K): V; 312 313 /** 314 * Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key 315 * 316 * @param { K } key - key key the index in LightWeightMap 317 * @returns { V | undefined } value if associated with key presents, undefined otherwise 318 * @syscap SystemCapability.Utils.Lang 319 * @crossplatform 320 * @atomicservice 321 * @since 20 322 * @arkts 1.2 323 */ 324 get(key: K): V | undefined; 325 326 /** 327 * Obtains the index of the key equal to a specified key in an LightWeightMap container 328 * 329 * @param { K } key - key key Looking for goals 330 * @returns { number } Subscript corresponding to target 331 * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. 332 * @syscap SystemCapability.Utils.Lang 333 * @since 8 334 */ 335 /** 336 * Obtains the index of the key equal to a specified key in an LightWeightMap container 337 * 338 * @param { K } key - key key Looking for goals 339 * @returns { number } Subscript corresponding to target 340 * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. 341 * @syscap SystemCapability.Utils.Lang 342 * @crossplatform 343 * @since 10 344 */ 345 /** 346 * Obtains the index of the key equal to a specified key in an LightWeightMap container 347 * 348 * @param { K } key - key key Looking for goals 349 * @returns { number } Subscript corresponding to target 350 * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. 351 * @syscap SystemCapability.Utils.Lang 352 * @crossplatform 353 * @atomicservice 354 * @since arkts {'1.1':'12', '1.2':'20'} 355 * @arkts 1.1&1.2 356 */ 357 getIndexOfKey(key: K): number; 358 /** 359 * Obtains the index of the value equal to a specified value in an LightWeightMap container 360 * 361 * @param { V } value - value value Looking for goals 362 * @returns { number } Subscript corresponding to target 363 * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. 364 * @syscap SystemCapability.Utils.Lang 365 * @since 8 366 */ 367 /** 368 * Obtains the index of the value equal to a specified value in an LightWeightMap container 369 * 370 * @param { V } value - value value Looking for goals 371 * @returns { number } Subscript corresponding to target 372 * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. 373 * @syscap SystemCapability.Utils.Lang 374 * @crossplatform 375 * @since 10 376 */ 377 /** 378 * Obtains the index of the value equal to a specified value in an LightWeightMap container 379 * 380 * @param { V } value - value value Looking for goals 381 * @returns { number } Subscript corresponding to target 382 * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. 383 * @syscap SystemCapability.Utils.Lang 384 * @crossplatform 385 * @atomicservice 386 * @since arkts {'1.1':'12', '1.2':'20'} 387 * @arkts 1.1&1.2 388 */ 389 getIndexOfValue(value: V): number; 390 /** 391 * Returns whether the Map object contains elements 392 * 393 * @returns { boolean } the boolean type 394 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 395 * @syscap SystemCapability.Utils.Lang 396 * @since 8 397 */ 398 /** 399 * Returns whether the Map object contains elements 400 * 401 * @returns { boolean } the boolean type 402 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 403 * @syscap SystemCapability.Utils.Lang 404 * @crossplatform 405 * @since 10 406 */ 407 /** 408 * Returns whether the Map object contains elements 409 * 410 * @returns { boolean } the boolean type 411 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 412 * @syscap SystemCapability.Utils.Lang 413 * @crossplatform 414 * @atomicservice 415 * @since arkts {'1.1':'12', '1.2':'20'} 416 * @arkts 1.1&1.2 417 */ 418 isEmpty(): boolean; 419 /** 420 * Obtains the key at the location identified by index in an LightWeightMap container 421 * 422 * @param { number } index - index index Target subscript for search 423 * @returns { K } the key of key-value pairs 424 * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. 425 * @throws { BusinessError } 10200001 - The value of index is out of range. 426 * @throws { BusinessError } 401 - Parameter error. Possible causes: 427 * 1.Mandatory parameters are left unspecified; 428 * 2.Incorrect parameter types; 429 * 3.Parameter verification failed. 430 * @syscap SystemCapability.Utils.Lang 431 * @since 8 432 */ 433 /** 434 * Obtains the key at the location identified by index in an LightWeightMap container 435 * 436 * @param { number } index - index index Target subscript for search 437 * @returns { K } the key of key-value pairs 438 * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. 439 * @throws { BusinessError } 10200001 - The value of index is out of range. 440 * @throws { BusinessError } 401 - Parameter error. Possible causes: 441 * 1.Mandatory parameters are left unspecified; 442 * 2.Incorrect parameter types; 443 * 3.Parameter verification failed. 444 * @syscap SystemCapability.Utils.Lang 445 * @crossplatform 446 * @since 10 447 */ 448 /** 449 * Obtains the key at the location identified by index in an LightWeightMap container 450 * 451 * @param { number } index - index index Target subscript for search 452 * @returns { K } the key of key-value pairs 453 * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. 454 * @throws { BusinessError } 10200001 - The value of index is out of range. 455 * @throws { BusinessError } 401 - Parameter error. Possible causes: 456 * 1.Mandatory parameters are left unspecified; 457 * 2.Incorrect parameter types; 458 * 3.Parameter verification failed. 459 * @syscap SystemCapability.Utils.Lang 460 * @crossplatform 461 * @atomicservice 462 * @since 12 463 */ 464 getKeyAt(index: number): K; 465 466 /** 467 * Obtains the key at the location identified by index in an LightWeightMap container 468 * 469 * @param { number } index - index index Target subscript for search 470 * @returns { K | undefined } the key of key-value pairs 471 * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. 472 * @throws { BusinessError } 10200001 - The value of index is out of range. 473 * @throws { BusinessError } 401 - Parameter error. Possible causes: 474 * 1.Mandatory parameters are left unspecified; 475 * 2.Incorrect parameter types; 476 * 3.Parameter verification failed. 477 * @syscap SystemCapability.Utils.Lang 478 * @crossplatform 479 * @atomicservice 480 * @since 20 481 * @arkts 1.2 482 */ 483 getKeyAt(index: number): K | undefined; 484 485 486 /** 487 * Obtains a ES6 iterator that contains all the keys of an LightWeightMap container 488 * 489 * @returns { IterableIterator<K> } 490 * @throws { BusinessError } 10200011 - The keys method cannot be bound. 491 * @syscap SystemCapability.Utils.Lang 492 * @since 8 493 */ 494 /** 495 * Obtains a ES6 iterator that contains all the keys of an LightWeightMap container 496 * 497 * @returns { IterableIterator<K> } 498 * @throws { BusinessError } 10200011 - The keys method cannot be bound. 499 * @syscap SystemCapability.Utils.Lang 500 * @crossplatform 501 * @since 10 502 */ 503 /** 504 * Obtains a ES6 iterator that contains all the keys of an LightWeightMap container 505 * 506 * @returns { IterableIterator<K> } 507 * @throws { BusinessError } 10200011 - The keys method cannot be bound. 508 * @syscap SystemCapability.Utils.Lang 509 * @crossplatform 510 * @atomicservice 511 * @since arkts {'1.1':'12', '1.2':'20'} 512 * @arkts 1.1&1.2 513 */ 514 keys(): IterableIterator<K>; 515 /** 516 * Adds all element groups in one map to another map 517 * 518 * @param { LightWeightMap<K, V> } map - map map the Map object to add members 519 * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 520 * @throws { BusinessError } 401 - Parameter error. Possible causes: 521 * 1.Mandatory parameters are left unspecified; 522 * 2.Incorrect parameter types. 523 * @syscap SystemCapability.Utils.Lang 524 * @since 8 525 */ 526 /** 527 * Adds all element groups in one map to another map 528 * 529 * @param { LightWeightMap<K, V> } map - map map the Map object to add members 530 * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 531 * @throws { BusinessError } 401 - Parameter error. Possible causes: 532 * 1.Mandatory parameters are left unspecified; 533 * 2.Incorrect parameter types. 534 * @syscap SystemCapability.Utils.Lang 535 * @crossplatform 536 * @since 10 537 */ 538 /** 539 * Adds all element groups in one map to another map 540 * 541 * @param { LightWeightMap<K, V> } map - map map the Map object to add members 542 * @throws { BusinessError } 10200011 - The setAll method cannot be bound. 543 * @throws { BusinessError } 401 - Parameter error. Possible causes: 544 * 1.Mandatory parameters are left unspecified; 545 * 2.Incorrect parameter types. 546 * @syscap SystemCapability.Utils.Lang 547 * @crossplatform 548 * @atomicservice 549 * @since arkts {'1.1':'12', '1.2':'20'} 550 * @arkts 1.1&1.2 551 */ 552 setAll(map: LightWeightMap<K, V>): void; 553 /** 554 * Adds or updates a(new) key-value pair with a key and value specified for the Map object 555 * 556 * @param { K } key - key key Added or updated targets 557 * @param { V } value - value Added or updated value 558 * @returns { Object } the map object after set 559 * @throws { BusinessError } 10200011 - The set method cannot be bound. 560 * @syscap SystemCapability.Utils.Lang 561 * @since 8 562 */ 563 /** 564 * Adds or updates a(new) key-value pair with a key and value specified for the Map object 565 * 566 * @param { K } key - key key Added or updated targets 567 * @param { V } value - value Added or updated value 568 * @returns { Object } the map object after set 569 * @throws { BusinessError } 10200011 - The set method cannot be bound. 570 * @syscap SystemCapability.Utils.Lang 571 * @crossplatform 572 * @since 10 573 */ 574 /** 575 * Adds or updates a(new) key-value pair with a key and value specified for the Map object 576 * 577 * @param { K } key - key key Added or updated targets 578 * @param { V } value - value Added or updated value 579 * @returns { Object } the map object after set 580 * @throws { BusinessError } 10200011 - The set method cannot be bound. 581 * @syscap SystemCapability.Utils.Lang 582 * @crossplatform 583 * @atomicservice 584 * @since arkts {'1.1':'12', '1.2':'20'} 585 * @arkts 1.1&1.2 586 */ 587 set(key: K, value: V): Object; 588 /** 589 * Remove the mapping for this key from this map if present 590 * 591 * @param { K } key - key key Target to be deleted 592 * @returns { V } Target mapped value 593 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 594 * @syscap SystemCapability.Utils.Lang 595 * @since 8 596 */ 597 /** 598 * Remove the mapping for this key from this map if present 599 * 600 * @param { K } key - key key Target to be deleted 601 * @returns { V } Target mapped value 602 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 603 * @syscap SystemCapability.Utils.Lang 604 * @crossplatform 605 * @since 10 606 */ 607 /** 608 * Remove the mapping for this key from this map if present 609 * 610 * @param { K } key - key key Target to be deleted 611 * @returns { V } Target mapped value 612 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 613 * @syscap SystemCapability.Utils.Lang 614 * @crossplatform 615 * @atomicservice 616 * @since 12 617 */ 618 remove(key: K): V; 619 620 /** 621 * Remove the mapping for this key from this map if present 622 * 623 * @param { K } key - key key Target to be deleted 624 * @returns { V | undefined } the value associated with the key if it was removed, undefined otherwise 625 * @syscap SystemCapability.Utils.Lang 626 * @crossplatform 627 * @atomicservice 628 * @since 20 629 * @arkts 1.2 630 */ 631 remove(key: K): V | undefined; 632 633 /** 634 * Deletes a key-value pair at the location identified by index from an LightWeightMap container 635 * 636 * @param { number } index - index index Target subscript for search 637 * @returns { boolean } the boolean type(Is there a delete value) 638 * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. 639 * @throws { BusinessError } 401 - Parameter error. Possible causes: 640 * 1.Mandatory parameters are left unspecified; 641 * 2.Incorrect parameter types. 642 * @syscap SystemCapability.Utils.Lang 643 * @since 8 644 */ 645 /** 646 * Deletes a key-value pair at the location identified by index from an LightWeightMap container 647 * 648 * @param { number } index - index index Target subscript for search 649 * @returns { boolean } the boolean type(Is there a delete value) 650 * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. 651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 652 * 1.Mandatory parameters are left unspecified; 653 * 2.Incorrect parameter types. 654 * @syscap SystemCapability.Utils.Lang 655 * @crossplatform 656 * @since 10 657 */ 658 /** 659 * Deletes a key-value pair at the location identified by index from an LightWeightMap container 660 * 661 * @param { number } index - index index Target subscript for search 662 * @returns { boolean } the boolean type(Is there a delete value) 663 * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. 664 * @throws { BusinessError } 401 - Parameter error. Possible causes: 665 * 1.Mandatory parameters are left unspecified; 666 * 2.Incorrect parameter types. 667 * @syscap SystemCapability.Utils.Lang 668 * @crossplatform 669 * @atomicservice 670 * @since arkts {'1.1':'12', '1.2':'20'} 671 * @arkts 1.1&1.2 672 */ 673 removeAt(index: number): boolean; 674 /** 675 * Removes all of the mapping from this map 676 * The map will be empty after this call returns 677 * 678 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 679 * @syscap SystemCapability.Utils.Lang 680 * @since 8 681 */ 682 /** 683 * Removes all of the mapping from this map 684 * The map will be empty after this call returns 685 * 686 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 687 * @syscap SystemCapability.Utils.Lang 688 * @crossplatform 689 * @since 10 690 */ 691 /** 692 * Removes all of the mapping from this map 693 * The map will be empty after this call returns 694 * 695 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 696 * @syscap SystemCapability.Utils.Lang 697 * @crossplatform 698 * @atomicservice 699 * @since arkts {'1.1':'12', '1.2':'20'} 700 * @arkts 1.1&1.2 701 */ 702 clear(): void; 703 /** 704 * Sets the value identified by index in an LightWeightMap container to a specified value 705 * 706 * @param { number } index - index index Target subscript for search 707 * @param { V } newValue - newValue value Updated the target mapped value 708 * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) 709 * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. 710 * @throws { BusinessError } 10200001 - The value of index is out of range. 711 * @throws { BusinessError } 401 - Parameter error. Possible causes: 712 * 1.Mandatory parameters are left unspecified; 713 * 2.Incorrect parameter types; 714 * 3.Parameter verification failed. 715 * @syscap SystemCapability.Utils.Lang 716 * @since 8 717 */ 718 /** 719 * Sets the value identified by index in an LightWeightMap container to a specified value 720 * 721 * @param { number } index - index index Target subscript for search 722 * @param { V } newValue - newValue value Updated the target mapped value 723 * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) 724 * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. 725 * @throws { BusinessError } 10200001 - The value of index is out of range. 726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 727 * 1.Mandatory parameters are left unspecified; 728 * 2.Incorrect parameter types; 729 * 3.Parameter verification failed. 730 * @syscap SystemCapability.Utils.Lang 731 * @crossplatform 732 * @since 10 733 */ 734 /** 735 * Sets the value identified by index in an LightWeightMap container to a specified value 736 * 737 * @param { number } index - index index Target subscript for search 738 * @param { V } newValue - newValue value Updated the target mapped value 739 * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) 740 * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. 741 * @throws { BusinessError } 10200001 - The value of index is out of range. 742 * @throws { BusinessError } 401 - Parameter error. Possible causes: 743 * 1.Mandatory parameters are left unspecified; 744 * 2.Incorrect parameter types; 745 * 3.Parameter verification failed. 746 * @syscap SystemCapability.Utils.Lang 747 * @crossplatform 748 * @atomicservice 749 * @since arkts {'1.1':'12', '1.2':'20'} 750 * @arkts 1.1&1.2 751 */ 752 setValueAt(index: number, newValue: V): boolean; 753 /** 754 * Executes the given callback function once for each real key in the map. 755 * It does not perform functions on deleted keys. 756 * 757 * @param { function } callbackFn - callbackFn 758 * callbackFn (required) A function that accepts up to three arguments. 759 * The function to be called for each element. 760 * @param { Object } [thisArg] - thisArg 761 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 762 * If thisArg is omitted, undefined is used as the this value. 763 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 764 * @throws { BusinessError } 401 - Parameter error. Possible causes: 765 * 1.Mandatory parameters are left unspecified; 766 * 2.Incorrect parameter types. 767 * @syscap SystemCapability.Utils.Lang 768 * @since 8 769 */ 770 /** 771 * Executes the given callback function once for each real key in the map. 772 * It does not perform functions on deleted keys. 773 * 774 * @param { function } callbackFn - callbackFn 775 * callbackFn (required) A function that accepts up to three arguments. 776 * The function to be called for each element. 777 * @param { Object } [thisArg] - thisArg 778 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 779 * If thisArg is omitted, undefined is used as the this value. 780 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 781 * @throws { BusinessError } 401 - Parameter error. Possible causes: 782 * 1.Mandatory parameters are left unspecified; 783 * 2.Incorrect parameter types. 784 * @syscap SystemCapability.Utils.Lang 785 * @crossplatform 786 * @since 10 787 */ 788 /** 789 * Executes the given callback function once for each real key in the map. 790 * It does not perform functions on deleted keys. 791 * 792 * @param { function } callbackFn - callbackFn 793 * callbackFn (required) A function that accepts up to three arguments. 794 * The function to be called for each element. 795 * @param { Object } [thisArg] - thisArg 796 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 797 * If thisArg is omitted, undefined is used as the this value. 798 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 799 * @throws { BusinessError } 401 - Parameter error. Possible causes: 800 * 1.Mandatory parameters are left unspecified; 801 * 2.Incorrect parameter types. 802 * @syscap SystemCapability.Utils.Lang 803 * @crossplatform 804 * @atomicservice 805 * @since 12 806 */ 807 forEach(callbackFn: (value?: V, key?: K, map?: LightWeightMap<K, V>) => void, thisArg?: Object): void; 808 809 /** 810 * Iterates over all key-value pairs in the LightWeightMap and executes a callback function for each entry. 811 * 812 * @param { LightWeightMapCbFn<K, V> } callbackFn - A callback function that will be executed for each key-value pair. 813 * @syscap SystemCapability.Utils.Lang 814 * @crossplatform 815 * @atomicservice 816 * @since 20 817 * @arkts 1.2 818 */ 819 forEach(callbackFn: LightWeightMapCbFn<K, V>): void; 820 821 /** 822 * returns an ES6 iterator.Each item of the iterator is a Javascript Object 823 * 824 * @returns { IterableIterator<[K, V]> } 825 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 826 * @syscap SystemCapability.Utils.Lang 827 * @since 8 828 */ 829 /** 830 * returns an ES6 iterator.Each item of the iterator is a Javascript Object 831 * 832 * @returns { IterableIterator<[K, V]> } 833 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 834 * @syscap SystemCapability.Utils.Lang 835 * @crossplatform 836 * @since 10 837 */ 838 /** 839 * returns an ES6 iterator.Each item of the iterator is a Javascript Object 840 * 841 * @returns { IterableIterator<[K, V]> } 842 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 843 * @syscap SystemCapability.Utils.Lang 844 * @crossplatform 845 * @atomicservice 846 * @since 12 847 */ 848 [Symbol.iterator](): IterableIterator<[K, V]>; 849 850 /** 851 * returns an ES6 iterator.Each item of the iterator is a Javascript Object 852 * 853 * @returns { IterableIterator<[K, V]> } an iterator for the LightWeightMap 854 * @syscap SystemCapability.Utils.Lang 855 * @crossplatform 856 * @atomicservice 857 * @since 20 858 * @arkts 1.2 859 */ 860 $_iterator(): IterableIterator<[K, V]>; 861 862 /** 863 * Obtains a string that contains all the keys and values in an LightWeightMap container 864 * 865 * @returns { String } 866 * @throws { BusinessError } 10200011 - The toString method cannot be bound. 867 * @syscap SystemCapability.Utils.Lang 868 * @since 8 869 */ 870 /** 871 * Obtains a string that contains all the keys and values in an LightWeightMap container 872 * 873 * @returns { String } 874 * @throws { BusinessError } 10200011 - The toString method cannot be bound. 875 * @syscap SystemCapability.Utils.Lang 876 * @crossplatform 877 * @since 10 878 */ 879 /** 880 * Obtains a string that contains all the keys and values in an LightWeightMap container 881 * 882 * @returns { String } 883 * @throws { BusinessError } 10200011 - The toString method cannot be bound. 884 * @syscap SystemCapability.Utils.Lang 885 * @crossplatform 886 * @atomicservice 887 * @since arkts {'1.1':'12', '1.2':'20'} 888 * @arkts 1.1&1.2 889 */ 890 toString(): String; 891 /** 892 * Obtains the value identified by index in an LightWeightMap container 893 * 894 * @param { number } index - index index Target subscript for search 895 * @returns { V } the value of key-value pairs 896 * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. 897 * @throws { BusinessError } 10200001 - The value of index is out of range. 898 * @throws { BusinessError } 401 - Parameter error. Possible causes: 899 * 1.Mandatory parameters are left unspecified; 900 * 2.Incorrect parameter types; 901 * 3.Parameter verification failed. 902 * @syscap SystemCapability.Utils.Lang 903 * @since 8 904 */ 905 /** 906 * Obtains the value identified by index in an LightWeightMap container 907 * 908 * @param { number } index - index index Target subscript for search 909 * @returns { V } the value of key-value pairs 910 * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. 911 * @throws { BusinessError } 10200001 - The value of index is out of range. 912 * @throws { BusinessError } 401 - Parameter error. Possible causes: 913 * 1.Mandatory parameters are left unspecified; 914 * 2.Incorrect parameter types; 915 * 3.Parameter verification failed. 916 * @syscap SystemCapability.Utils.Lang 917 * @crossplatform 918 * @since 10 919 */ 920 /** 921 * Obtains the value identified by index in an LightWeightMap container 922 * 923 * @param { number } index - index index Target subscript for search 924 * @returns { V } the value of key-value pairs 925 * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. 926 * @throws { BusinessError } 10200001 - The value of index is out of range. 927 * @throws { BusinessError } 401 - Parameter error. Possible causes: 928 * 1.Mandatory parameters are left unspecified; 929 * 2.Incorrect parameter types; 930 * 3.Parameter verification failed. 931 * @syscap SystemCapability.Utils.Lang 932 * @crossplatform 933 * @atomicservice 934 * @since 12 935 */ 936 getValueAt(index: number): V; 937 938 /** 939 * Obtains the value identified by index in an LightWeightMap container 940 * 941 * @param { number } index - index index Target subscript for search 942 * @returns { V | undefined } the value of key-value pairs 943 * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. 944 * @throws { BusinessError } 10200001 - The value of index is out of range. 945 * @throws { BusinessError } 401 - Parameter error. Possible causes: 946 * 1.Mandatory parameters are left unspecified; 947 * 2.Incorrect parameter types; 948 * 3.Parameter verification failed. 949 * @syscap SystemCapability.Utils.Lang 950 * @crossplatform 951 * @atomicservice 952 * @since 20 953 * @arkts 1.2 954 */ 955 getValueAt(index: number): V | undefined; 956 957 /** 958 * Returns an iterator of the values contained in this map 959 * 960 * @returns { IterableIterator<V> } 961 * @throws { BusinessError } 10200011 - The values method cannot be bound. 962 * @syscap SystemCapability.Utils.Lang 963 * @since 8 964 */ 965 /** 966 * Returns an iterator of the values contained in this map 967 * 968 * @returns { IterableIterator<V> } 969 * @throws { BusinessError } 10200011 - The values method cannot be bound. 970 * @syscap SystemCapability.Utils.Lang 971 * @crossplatform 972 * @since 10 973 */ 974 /** 975 * Returns an iterator of the values contained in this map 976 * 977 * @returns { IterableIterator<V> } 978 * @throws { BusinessError } 10200011 - The values method cannot be bound. 979 * @syscap SystemCapability.Utils.Lang 980 * @crossplatform 981 * @atomicservice 982 * @since arkts {'1.1':'12', '1.2':'20'} 983 * @arkts 1.1&1.2 984 */ 985 values(): IterableIterator<V>; 986} 987 988 /** 989 * The type of LightWeightMap callback function. 990 * 991 * @typedef { function } LightWeightMapCbFn 992 * @param { V } value - The value of the current entry 993 * @param { K } key - The key of the current entry 994 * @param { LightWeightMap<K, V> } map - The LightWeightMap instance being traversed 995 * @returns { void } This callback does not return a value 996 * @syscap SystemCapability.Utils.Lang 997 * @atomicservice 998 * @since 20 999 * @arkts 1.2 1000 */ 1001 type LightWeightMapCbFn<K, V> = (value: V, key: K, map: LightWeightMap<K, V>) => void; 1002 1003export default LightWeightMap; 1004