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