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 * List is implemented based on the singly linked list. Each node has a reference pointing to the next element. 23 * When querying an element, the system traverses the list from the beginning. 24 * 25 * @syscap SystemCapability.Utils.Lang 26 * @since 8 27 */ 28/** 29 * List is implemented based on the singly linked list. Each node has a reference pointing to the next element. 30 * When querying an element, the system traverses the list from the beginning. 31 * 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * List is implemented based on the singly linked list. Each node has a reference pointing to the next element. 38 * When querying an element, the system traverses the list from the beginning. 39 * 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since 12 44 */ 45declare class List<T> { 46 /** 47 * A constructor used to create a List object. 48 * 49 * @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked. 50 * @syscap SystemCapability.Utils.Lang 51 * @since 8 52 */ 53 /** 54 * A constructor used to create a List object. 55 * 56 * @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked. 57 * @syscap SystemCapability.Utils.Lang 58 * @crossplatform 59 * @since 10 60 */ 61 /** 62 * A constructor used to create a List object. 63 * 64 * @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked. 65 * @syscap SystemCapability.Utils.Lang 66 * @crossplatform 67 * @atomicservice 68 * @since 12 69 */ 70 constructor(); 71 /** 72 * Gets the element number of the List. This is a number one higher than the highest index in the list. 73 * 74 * @syscap SystemCapability.Utils.Lang 75 * @since 8 76 */ 77 /** 78 * Gets the element number of the List. This is a number one higher than the highest index in the list. 79 * 80 * @syscap SystemCapability.Utils.Lang 81 * @crossplatform 82 * @since 10 83 */ 84 /** 85 * Gets the element number of the List. This is a number one higher than the highest index in the list. 86 * 87 * @syscap SystemCapability.Utils.Lang 88 * @crossplatform 89 * @atomicservice 90 * @since 12 91 */ 92 length: number; 93 /** 94 * Appends the specified element to the end of this list. 95 * 96 * @param { T } element - element element to be appended to this list 97 * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails. 98 * @throws { BusinessError } 10200011 - The add method cannot be bound. 99 * @syscap SystemCapability.Utils.Lang 100 * @since 8 101 */ 102 /** 103 * Appends the specified element to the end of this list. 104 * 105 * @param { T } element - element element to be appended to this list 106 * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails. 107 * @throws { BusinessError } 10200011 - The add method cannot be bound. 108 * @syscap SystemCapability.Utils.Lang 109 * @crossplatform 110 * @since 10 111 */ 112 /** 113 * Appends the specified element to the end of this list. 114 * 115 * @param { T } element - element element to be appended to this list 116 * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails. 117 * @throws { BusinessError } 10200011 - The add method cannot be bound. 118 * @syscap SystemCapability.Utils.Lang 119 * @crossplatform 120 * @atomicservice 121 * @since 12 122 */ 123 add(element: T): boolean; 124 /** 125 * Inserts the specified element at the specified position in this list. 126 * 127 * @param { T } element - element element element to be inserted 128 * @param { number } index - index index index at which the specified element is to be inserted 129 * @throws { BusinessError } 10200011 - The insert method cannot be bound. 130 * @throws { BusinessError } 10200001 - The value of index is out of range. 131 * @throws { BusinessError } 401 - Parameter error. Possible causes: 132 * 1.Mandatory parameters are left unspecified; 133 * 2.Incorrect parameter types; 134 * 3.Parameter verification failed. 135 * @syscap SystemCapability.Utils.Lang 136 * @since 8 137 */ 138 /** 139 * Inserts the specified element at the specified position in this list. 140 * 141 * @param { T } element - element element element to be inserted 142 * @param { number } index - index index index at which the specified element is to be inserted 143 * @throws { BusinessError } 10200011 - The insert method cannot be bound. 144 * @throws { BusinessError } 10200001 - The value of index is out of range. 145 * @throws { BusinessError } 401 - Parameter error. Possible causes: 146 * 1.Mandatory parameters are left unspecified; 147 * 2.Incorrect parameter types; 148 * 3.Parameter verification failed. 149 * @syscap SystemCapability.Utils.Lang 150 * @crossplatform 151 * @since 10 152 */ 153 /** 154 * Inserts the specified element at the specified position in this list. 155 * 156 * @param { T } element - element element element to be inserted 157 * @param { number } index - index index index at which the specified element is to be inserted 158 * @throws { BusinessError } 10200011 - The insert method cannot be bound. 159 * @throws { BusinessError } 10200001 - The value of index is out of range. 160 * @throws { BusinessError } 401 - Parameter error. Possible causes: 161 * 1.Mandatory parameters are left unspecified; 162 * 2.Incorrect parameter types; 163 * 3.Parameter verification failed. 164 * @syscap SystemCapability.Utils.Lang 165 * @crossplatform 166 * @atomicservice 167 * @since 12 168 */ 169 insert(element: T, index: number): void; 170 /** 171 * Returns the element at the specified position in this list, 172 * or returns undefined if this list is empty 173 * 174 * @param { number } index - index index specified position 175 * @returns { T } the T type 176 * @throws { BusinessError } 10200011 - The get method cannot be bound. 177 * @throws { BusinessError } 401 - Parameter error. Possible causes: 178 * 1.Mandatory parameters are left unspecified; 179 * 2.Incorrect parameter types. 180 * @syscap SystemCapability.Utils.Lang 181 * @since 8 182 */ 183 /** 184 * Returns the element at the specified position in this list, 185 * or returns undefined if this list is empty 186 * 187 * @param { number } index - index index specified position 188 * @returns { T } the T type 189 * @throws { BusinessError } 10200011 - The get method cannot be bound. 190 * @throws { BusinessError } 401 - Parameter error. Possible causes: 191 * 1.Mandatory parameters are left unspecified; 192 * 2.Incorrect parameter types. 193 * @syscap SystemCapability.Utils.Lang 194 * @crossplatform 195 * @since 10 196 */ 197 /** 198 * Returns the element at the specified position in this list, 199 * or returns undefined if this list is empty 200 * 201 * @param { number } index - index index specified position 202 * @returns { T } the T type 203 * @throws { BusinessError } 10200011 - The get method cannot be bound. 204 * @throws { BusinessError } 401 - Parameter error. Possible causes: 205 * 1.Mandatory parameters are left unspecified; 206 * 2.Incorrect parameter types. 207 * @syscap SystemCapability.Utils.Lang 208 * @crossplatform 209 * @atomicservice 210 * @since 12 211 */ 212 get(index: number): T; 213 /** 214 * Check if list contains the specified element 215 * 216 * @param { T } element - element element element to be contained 217 * @returns { boolean } the boolean type,if list contains the specified element,return true,else return false 218 * @throws { BusinessError } 10200011 - The has method cannot be bound. 219 * @syscap SystemCapability.Utils.Lang 220 * @since 8 221 */ 222 /** 223 * Check if list contains the specified element 224 * 225 * @param { T } element - element element element to be contained 226 * @returns { boolean } the boolean type,if list contains the specified element,return true,else return false 227 * @throws { BusinessError } 10200011 - The has method cannot be bound. 228 * @syscap SystemCapability.Utils.Lang 229 * @crossplatform 230 * @since 10 231 */ 232 /** 233 * Check if list contains the specified element 234 * 235 * @param { T } element - element element element to be contained 236 * @returns { boolean } the boolean type,if list contains the specified element,return true,else return false 237 * @throws { BusinessError } 10200011 - The has method cannot be bound. 238 * @syscap SystemCapability.Utils.Lang 239 * @crossplatform 240 * @atomicservice 241 * @since 12 242 */ 243 has(element: T): boolean; 244 /** 245 * Returns the index of the first occurrence of the specified element 246 * in this list, or -1 if this list does not contain the element. 247 * 248 * @param { T } element - element element element to be contained 249 * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. 250 * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. 251 * @syscap SystemCapability.Utils.Lang 252 * @since 8 253 */ 254 /** 255 * Returns the index of the first occurrence of the specified element 256 * in this list, or -1 if this list does not contain the element. 257 * 258 * @param { T } element - element element element to be contained 259 * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. 260 * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. 261 * @syscap SystemCapability.Utils.Lang 262 * @crossplatform 263 * @since 10 264 */ 265 /** 266 * Returns the index of the first occurrence of the specified element 267 * in this list, or -1 if this list does not contain the element. 268 * 269 * @param { T } element - element element element to be contained 270 * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. 271 * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. 272 * @syscap SystemCapability.Utils.Lang 273 * @crossplatform 274 * @atomicservice 275 * @since 12 276 */ 277 getIndexOf(element: T): number; 278 /** 279 * Find the corresponding element according to the index. 280 * 281 * @param { number } index - index index the index in the list 282 * @returns { T } the T type ,returns undefined if list is empty,If the index is 283 * out of bounds (greater than or equal to length or less than 0), throw an exception 284 * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. 285 * @throws { BusinessError } 10200001 - The value of index is out of range. 286 * @throws { BusinessError } 401 - Parameter error. Possible causes: 287 * 1.Mandatory parameters are left unspecified; 288 * 2.Incorrect parameter types. 289 * @syscap SystemCapability.Utils.Lang 290 * @since 8 291 */ 292 /** 293 * Find the corresponding element according to the index. 294 * 295 * @param { number } index - index index the index in the list 296 * @returns { T } the T type ,returns undefined if list is empty,If the index is 297 * out of bounds (greater than or equal to length or less than 0), throw an exception 298 * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. 299 * @throws { BusinessError } 10200001 - The value of index is out of range. 300 * @throws { BusinessError } 401 - Parameter error. Possible causes: 301 * 1.Mandatory parameters are left unspecified; 302 * 2.Incorrect parameter types. 303 * @syscap SystemCapability.Utils.Lang 304 * @crossplatform 305 * @since 10 306 */ 307 /** 308 * Find the corresponding element according to the index. 309 * 310 * @param { number } index - index index the index in the list 311 * @returns { T } the T type ,returns undefined if list is empty,If the index is 312 * out of bounds (greater than or equal to length or less than 0), throw an exception 313 * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. 314 * @throws { BusinessError } 10200001 - The value of index is out of range. 315 * @throws { BusinessError } 401 - Parameter error. Possible causes: 316 * 1.Mandatory parameters are left unspecified; 317 * 2.Incorrect parameter types. 318 * @syscap SystemCapability.Utils.Lang 319 * @crossplatform 320 * @atomicservice 321 * @since 12 322 */ 323 removeByIndex(index: number): T; 324 /** 325 * Removes the first occurrence of the specified element from this list, 326 * if it is present. If the list does not contain the element, it is 327 * unchanged. More formally, removes the element with the lowest index 328 * 329 * @param { T } element - element element element to remove 330 * @returns { boolean } the boolean type ,If there is no such element, return false 331 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 332 * @syscap SystemCapability.Utils.Lang 333 * @since 8 334 */ 335 /** 336 * Removes the first occurrence of the specified element from this list, 337 * if it is present. If the list does not contain the element, it is 338 * unchanged. More formally, removes the element with the lowest index 339 * 340 * @param { T } element - element element element to remove 341 * @returns { boolean } the boolean type ,If there is no such element, return false 342 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 343 * @syscap SystemCapability.Utils.Lang 344 * @crossplatform 345 * @since 10 346 */ 347 /** 348 * Removes the first occurrence of the specified element from this list, 349 * if it is present. If the list does not contain the element, it is 350 * unchanged. More formally, removes the element with the lowest index 351 * 352 * @param { T } element - element element element to remove 353 * @returns { boolean } the boolean type ,If there is no such element, return false 354 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 355 * @syscap SystemCapability.Utils.Lang 356 * @crossplatform 357 * @atomicservice 358 * @since 12 359 */ 360 remove(element: T): boolean; 361 /** 362 * Returns in the index of the last occurrence of the specified element in this list , 363 * or -1 if the list does not contain the element. 364 * 365 * @param { T } element - element element element to find 366 * @returns { number } the number type 367 * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. 368 * @syscap SystemCapability.Utils.Lang 369 * @since 8 370 */ 371 /** 372 * Returns in the index of the last occurrence of the specified element in this list , 373 * or -1 if the list does not contain the element. 374 * 375 * @param { T } element - element element element to find 376 * @returns { number } the number type 377 * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. 378 * @syscap SystemCapability.Utils.Lang 379 * @crossplatform 380 * @since 10 381 */ 382 /** 383 * Returns in the index of the last occurrence of the specified element in this list , 384 * or -1 if the list does not contain the element. 385 * 386 * @param { T } element - element element element to find 387 * @returns { number } the number type 388 * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. 389 * @syscap SystemCapability.Utils.Lang 390 * @crossplatform 391 * @atomicservice 392 * @since 12 393 */ 394 getLastIndexOf(element: T): number; 395 /** 396 * Returns the first element (the item at index 0) of this list. 397 * or returns undefined if list is empty 398 * 399 * @returns { T } the T type ,returns undefined if list is empty 400 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 401 * @syscap SystemCapability.Utils.Lang 402 * @since 8 403 */ 404 /** 405 * Returns the first element (the item at index 0) of this list. 406 * or returns undefined if list is empty 407 * 408 * @returns { T } the T type ,returns undefined if list is empty 409 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 410 * @syscap SystemCapability.Utils.Lang 411 * @crossplatform 412 * @since 10 413 */ 414 /** 415 * Returns the first element (the item at index 0) of this list. 416 * or returns undefined if list is empty 417 * 418 * @returns { T } the T type ,returns undefined if list is empty 419 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 420 * @syscap SystemCapability.Utils.Lang 421 * @crossplatform 422 * @atomicservice 423 * @since 12 424 */ 425 getFirst(): T; 426 /** 427 * Returns the Last element (the item at index length-1) of this list. 428 * or returns undefined if list is empty 429 * 430 * @returns { T } the T type ,returns undefined if list is empty 431 * @throws { BusinessError } 10200011 - The getLast method cannot be bound. 432 * @syscap SystemCapability.Utils.Lang 433 * @since 8 434 */ 435 /** 436 * Returns the Last element (the item at index length-1) of this list. 437 * or returns undefined if list is empty 438 * 439 * @returns { T } the T type ,returns undefined if list is empty 440 * @throws { BusinessError } 10200011 - The getLast method cannot be bound. 441 * @syscap SystemCapability.Utils.Lang 442 * @crossplatform 443 * @since 10 444 */ 445 /** 446 * Returns the Last element (the item at index length-1) of this list. 447 * or returns undefined if list is empty 448 * 449 * @returns { T } the T type ,returns undefined if list is empty 450 * @throws { BusinessError } 10200011 - The getLast method cannot be bound. 451 * @syscap SystemCapability.Utils.Lang 452 * @crossplatform 453 * @atomicservice 454 * @since 12 455 */ 456 getLast(): T; 457 /** 458 * Replaces the element at the specified position in this List with the specified element 459 * 460 * @param { number } index - index index index to find 461 * @param { T } element - element element replaced element 462 * @returns { T } the T type 463 * @throws { BusinessError } 10200011 - The set method cannot be bound. 464 * @throws { BusinessError } 10200001 - The value of index is out of range. 465 * @throws { BusinessError } 401 - Parameter error. Possible causes: 466 * 1.Mandatory parameters are left unspecified; 467 * 2.Incorrect parameter types. 468 * @syscap SystemCapability.Utils.Lang 469 * @since 8 470 */ 471 /** 472 * Replaces the element at the specified position in this List with the specified element 473 * 474 * @param { number } index - index index index to find 475 * @param { T } element - element element replaced element 476 * @returns { T } the T type 477 * @throws { BusinessError } 10200011 - The set method cannot be bound. 478 * @throws { BusinessError } 10200001 - The value of index is out of range. 479 * @throws { BusinessError } 401 - Parameter error. Possible causes: 480 * 1.Mandatory parameters are left unspecified; 481 * 2.Incorrect parameter types. 482 * @syscap SystemCapability.Utils.Lang 483 * @crossplatform 484 * @since 10 485 */ 486 /** 487 * Replaces the element at the specified position in this List with the specified element 488 * 489 * @param { number } index - index index index to find 490 * @param { T } element - element element replaced element 491 * @returns { T } the T type 492 * @throws { BusinessError } 10200011 - The set method cannot be bound. 493 * @throws { BusinessError } 10200001 - The value of index is out of range. 494 * @throws { BusinessError } 401 - Parameter error. Possible causes: 495 * 1.Mandatory parameters are left unspecified; 496 * 2.Incorrect parameter types. 497 * @syscap SystemCapability.Utils.Lang 498 * @crossplatform 499 * @atomicservice 500 * @since 12 501 */ 502 set(index: number, element: T): T; 503 /** 504 * Compares the specified object with this list for equality.if the object are the same as this list 505 * return true, otherwise return false. 506 * 507 * @param { Object } obj - obj obj Compare objects 508 * @returns { boolean } the boolean type 509 * @throws { BusinessError } 10200011 - The equal method cannot be bound. 510 * @syscap SystemCapability.Utils.Lang 511 * @since 8 512 */ 513 /** 514 * Compares the specified object with this list for equality.if the object are the same as this list 515 * return true, otherwise return false. 516 * 517 * @param { Object } obj - obj obj Compare objects 518 * @returns { boolean } the boolean type 519 * @throws { BusinessError } 10200011 - The equal method cannot be bound. 520 * @syscap SystemCapability.Utils.Lang 521 * @crossplatform 522 * @since 10 523 */ 524 /** 525 * Compares the specified object with this list for equality.if the object are the same as this list 526 * return true, otherwise return false. 527 * 528 * @param { Object } obj - obj obj Compare objects 529 * @returns { boolean } the boolean type 530 * @throws { BusinessError } 10200011 - The equal method cannot be bound. 531 * @syscap SystemCapability.Utils.Lang 532 * @crossplatform 533 * @atomicservice 534 * @since 12 535 */ 536 equal(obj: Object): boolean; 537 /** 538 * Replaces each element of this list with the result of applying the operator to that element. 539 * 540 * @param { function } callbackFn - callbackFn 541 * callbackFn (required) A function that accepts up to three arguments. 542 * The function to be called for each element. 543 * @param { Object } [thisArg] - thisArg 544 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 545 * If thisArg is omitted, undefined is used as the this value. 546 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 547 * @throws { BusinessError } 401 - Parameter error. Possible causes: 548 * 1.Mandatory parameters are left unspecified; 549 * 2.Incorrect parameter types. 550 * @syscap SystemCapability.Utils.Lang 551 * @since 8 552 */ 553 /** 554 * Replaces each element of this list with the result of applying the operator to that element. 555 * 556 * @param { function } callbackFn - callbackFn 557 * callbackFn (required) A function that accepts up to three arguments. 558 * The function to be called for each element. 559 * @param { Object } [thisArg] - thisArg 560 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 561 * If thisArg is omitted, undefined is used as the this value. 562 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 563 * @throws { BusinessError } 401 - Parameter error. Possible causes: 564 * 1.Mandatory parameters are left unspecified; 565 * 2.Incorrect parameter types. 566 * @syscap SystemCapability.Utils.Lang 567 * @crossplatform 568 * @since 10 569 */ 570 /** 571 * Replaces each element of this list with the result of applying the operator to that element. 572 * 573 * @param { function } callbackFn - callbackFn 574 * callbackFn (required) A function that accepts up to three arguments. 575 * The function to be called for each element. 576 * @param { Object } [thisArg] - thisArg 577 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 578 * If thisArg is omitted, undefined is used as the this value. 579 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 580 * @throws { BusinessError } 401 - Parameter error. Possible causes: 581 * 1.Mandatory parameters are left unspecified; 582 * 2.Incorrect parameter types. 583 * @syscap SystemCapability.Utils.Lang 584 * @crossplatform 585 * @atomicservice 586 * @since 12 587 */ 588 forEach(callbackFn: (value: T, index?: number, List?: List<T>) => void, thisArg?: Object): void; 589 /** 590 * Sorts this list according to the order induced by the specified comparator 591 * 592 * @param { function } comparator - comparator 593 * comparator (required) A function that accepts up to two arguments. 594 * Specifies the sort order. Must be a function,return number type,If it returns firstValue 595 * minus secondValue, it returns an list sorted in ascending order;If it returns secondValue 596 * minus firstValue, it returns an list sorted in descending order; 597 * @throws { BusinessError } 401 - Parameter error. Possible causes: 598 * 1.Mandatory parameters are left unspecified; 599 * 2.Incorrect parameter types. 600 * @throws { BusinessError } 10200011 - The sort method cannot be bound. 601 * @syscap SystemCapability.Utils.Lang 602 * @since 8 603 */ 604 /** 605 * Sorts this list according to the order induced by the specified comparator 606 * 607 * @param { function } comparator - comparator 608 * comparator (required) A function that accepts up to two arguments. 609 * Specifies the sort order. Must be a function,return number type,If it returns firstValue 610 * minus secondValue, it returns an list sorted in ascending order;If it returns secondValue 611 * minus firstValue, it returns an list sorted in descending order; 612 * @throws { BusinessError } 401 - Parameter error. Possible causes: 613 * 1.Mandatory parameters are left unspecified; 614 * 2.Incorrect parameter types. 615 * @throws { BusinessError } 10200011 - The sort method cannot be bound. 616 * @syscap SystemCapability.Utils.Lang 617 * @crossplatform 618 * @since 10 619 */ 620 /** 621 * Sorts this list according to the order induced by the specified comparator 622 * 623 * @param { function } comparator - comparator 624 * comparator (required) A function that accepts up to two arguments. 625 * Specifies the sort order. Must be a function,return number type,If it returns firstValue 626 * minus secondValue, it returns an list sorted in ascending order;If it returns secondValue 627 * minus firstValue, it returns an list sorted in descending order; 628 * @throws { BusinessError } 401 - Parameter error. Possible causes: 629 * 1.Mandatory parameters are left unspecified; 630 * 2.Incorrect parameter types. 631 * @throws { BusinessError } 10200011 - The sort method cannot be bound. 632 * @syscap SystemCapability.Utils.Lang 633 * @crossplatform 634 * @atomicservice 635 * @since 12 636 */ 637 sort(comparator: (firstValue: T, secondValue: T) => number): void; 638 /** 639 * Removes all of the elements from this list.The list will 640 * be empty after this call returns.length becomes 0 641 * 642 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 643 * @syscap SystemCapability.Utils.Lang 644 * @since 8 645 */ 646 /** 647 * Removes all of the elements from this list.The list will 648 * be empty after this call returns.length becomes 0 649 * 650 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 651 * @syscap SystemCapability.Utils.Lang 652 * @crossplatform 653 * @since 10 654 */ 655 /** 656 * Removes all of the elements from this list.The list will 657 * be empty after this call returns.length becomes 0 658 * 659 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 660 * @syscap SystemCapability.Utils.Lang 661 * @crossplatform 662 * @atomicservice 663 * @since 12 664 */ 665 clear(): void; 666 /** 667 * Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive 668 * 669 * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position 670 * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index 671 * @returns { List<T> } 672 * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. 673 * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. 674 * @throws { BusinessError } 401 - Parameter error. Possible causes: 675 * 1.Mandatory parameters are left unspecified; 676 * 2.Incorrect parameter types. 677 * @syscap SystemCapability.Utils.Lang 678 * @since 8 679 */ 680 /** 681 * Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive 682 * 683 * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position 684 * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index 685 * @returns { List<T> } 686 * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. 687 * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. 688 * @throws { BusinessError } 401 - Parameter error. Possible causes: 689 * 1.Mandatory parameters are left unspecified; 690 * 2.Incorrect parameter types. 691 * @syscap SystemCapability.Utils.Lang 692 * @crossplatform 693 * @since 10 694 */ 695 /** 696 * Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive 697 * 698 * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position 699 * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index 700 * @returns { List<T> } 701 * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. 702 * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. 703 * @throws { BusinessError } 401 - Parameter error. Possible causes: 704 * 1.Mandatory parameters are left unspecified; 705 * 2.Incorrect parameter types. 706 * @syscap SystemCapability.Utils.Lang 707 * @crossplatform 708 * @atomicservice 709 * @since 12 710 */ 711 getSubList(fromIndex: number, toIndex: number): List<T>; 712 /** 713 * Replaces each element of this list with the result of applying the operator to that element. 714 * 715 * @param { function } callbackFn - callbackFn 716 * callbackFn (required) A function that accepts up to three arguments. 717 * The function to be called for each element. 718 * @param { Object } [thisArg] - thisArg 719 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 720 * If thisArg is omitted, undefined is used as the this value. 721 * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound. 722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 723 * 1.Mandatory parameters are left unspecified; 724 * 2.Incorrect parameter types. 725 * @syscap SystemCapability.Utils.Lang 726 * @since 8 727 */ 728 /** 729 * Replaces each element of this list with the result of applying the operator to that element. 730 * 731 * @param { function } callbackFn - callbackFn 732 * callbackFn (required) A function that accepts up to three arguments. 733 * The function to be called for each element. 734 * @param { Object } [thisArg] - thisArg 735 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 736 * If thisArg is omitted, undefined is used as the this value. 737 * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound. 738 * @throws { BusinessError } 401 - Parameter error. Possible causes: 739 * 1.Mandatory parameters are left unspecified; 740 * 2.Incorrect parameter types. 741 * @syscap SystemCapability.Utils.Lang 742 * @crossplatform 743 * @since 10 744 */ 745 /** 746 * Replaces each element of this list with the result of applying the operator to that element. 747 * 748 * @param { function } callbackFn - callbackFn 749 * callbackFn (required) A function that accepts up to three arguments. 750 * The function to be called for each element. 751 * @param { Object } [thisArg] - thisArg 752 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 753 * If thisArg is omitted, undefined is used as the this value. 754 * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound. 755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 756 * 1.Mandatory parameters are left unspecified; 757 * 2.Incorrect parameter types. 758 * @syscap SystemCapability.Utils.Lang 759 * @crossplatform 760 * @atomicservice 761 * @since 12 762 */ 763 replaceAllElements(callbackFn: (value: T, index?: number, list?: List<T>) => T, thisArg?: Object): void; 764 /** 765 * convert list to array 766 * 767 * @returns { Array<T> } the Array type 768 * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. 769 * @syscap SystemCapability.Utils.Lang 770 * @since 8 771 */ 772 /** 773 * convert list to array 774 * 775 * @returns { Array<T> } the Array type 776 * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. 777 * @syscap SystemCapability.Utils.Lang 778 * @crossplatform 779 * @since 10 780 */ 781 /** 782 * convert list to array 783 * 784 * @returns { Array<T> } the Array type 785 * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. 786 * @syscap SystemCapability.Utils.Lang 787 * @crossplatform 788 * @atomicservice 789 * @since 12 790 */ 791 convertToArray(): Array<T>; 792 /** 793 * Determine whether list is empty and whether there is an element 794 * 795 * @returns { boolean } the boolean type 796 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 797 * @syscap SystemCapability.Utils.Lang 798 * @since 8 799 */ 800 /** 801 * Determine whether list is empty and whether there is an element 802 * 803 * @returns { boolean } the boolean type 804 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 805 * @syscap SystemCapability.Utils.Lang 806 * @crossplatform 807 * @since 10 808 */ 809 /** 810 * Determine whether list is empty and whether there is an element 811 * 812 * @returns { boolean } the boolean type 813 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 814 * @syscap SystemCapability.Utils.Lang 815 * @crossplatform 816 * @atomicservice 817 * @since 12 818 */ 819 isEmpty(): boolean; 820 /** 821 * returns an iterator.Each item of the iterator is a Javascript Object 822 * 823 * @returns { IterableIterator<T> } 824 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 825 * @syscap SystemCapability.Utils.Lang 826 * @since 8 827 */ 828 /** 829 * returns an iterator.Each item of the iterator is a Javascript Object 830 * 831 * @returns { IterableIterator<T> } 832 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 833 * @syscap SystemCapability.Utils.Lang 834 * @crossplatform 835 * @since 10 836 */ 837 /** 838 * returns an iterator.Each item of the iterator is a Javascript Object 839 * 840 * @returns { IterableIterator<T> } 841 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 842 * @syscap SystemCapability.Utils.Lang 843 * @crossplatform 844 * @atomicservice 845 * @since 12 846 */ 847 [Symbol.iterator](): IterableIterator<T>; 848} 849 850export default List; 851