• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkTS
19 */
20
21/**
22 * ArrayList is a linear data structure that is implemented based on arrays.
23 * ArrayList can dynamically adjust the capacity based on project requirements. It increases the capacity by 50% each time.
24 *
25 * @syscap SystemCapability.Utils.Lang
26 * @since 8
27 */
28/**
29 * ArrayList is a linear data structure that is implemented based on arrays.
30 * ArrayList can dynamically adjust the capacity based on project requirements. It increases the capacity by 50% each time.
31 *
32 * @syscap SystemCapability.Utils.Lang
33 * @crossplatform
34 * @since 10
35 */
36/**
37 * ArrayList is a linear data structure that is implemented based on arrays.
38 * ArrayList can dynamically adjust the capacity based on project requirements. It increases the capacity by 50% each time.
39 *
40 * @syscap SystemCapability.Utils.Lang
41 * @crossplatform
42 * @atomicservice
43 * @since arkts {'1.1':'12', '1.2':'20'}
44 * @arkts 1.1&1.2
45 */
46declare class ArrayList<T> {
47  /**
48   * A constructor used to create a ArrayList object.
49   *
50   * @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
51   * @syscap SystemCapability.Utils.Lang
52   * @since 8
53   */
54  /**
55   * A constructor used to create a ArrayList object.
56   *
57   * @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
58   * @syscap SystemCapability.Utils.Lang
59   * @crossplatform
60   * @since 10
61   */
62  /**
63   * A constructor used to create an ArrayList instance.
64   *
65   * @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
66   * @syscap SystemCapability.Utils.Lang
67   * @crossplatform
68   * @atomicservice
69   * @since arkts {'1.1':'12', '1.2':'20'}
70   * @arkts 1.1&1.2
71   */
72  constructor();
73  /**
74   * Gets the element number of the ArrayList.This is a number one higher than the highest index in the arraylist.
75   *
76   * @type { number }
77   * @syscap SystemCapability.Utils.Lang
78   * @since 8
79   */
80  /**
81   * Gets the element number of the ArrayList.This is a number one higher than the highest index in the arraylist.
82   *
83   * @type { number }
84   * @syscap SystemCapability.Utils.Lang
85   * @crossplatform
86   * @since 10
87   */
88  /**
89   * Number of elements in an array list.
90   *
91   * @type { number }
92   * @syscap SystemCapability.Utils.Lang
93   * @crossplatform
94   * @atomicservice
95   * @since 12
96   */
97  length: number;
98  /**
99   * Gets the number of elements in an array list.
100   *
101   * @type { number }
102   * @syscap SystemCapability.Utils.Lang
103   * @crossplatform
104   * @atomicservice
105   * @since 20
106   * @arkts 1.2
107   */
108  get length(): number;
109  /**
110   * Appends the specified element to the end of this arraylist.
111   *
112   * @param { T } element - element element to be appended to this arraylist
113   * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
114   * @throws { BusinessError } 10200011 - The add method cannot be bound.
115   * @syscap SystemCapability.Utils.Lang
116   * @since 8
117   */
118  /**
119   * Appends the specified element to the end of this arraylist.
120   *
121   * @param { T } element - element element to be appended to this arraylist
122   * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
123   * @throws { BusinessError } 10200011 - The add method cannot be bound.
124   * @syscap SystemCapability.Utils.Lang
125   * @crossplatform
126   * @since 10
127   */
128  /**
129   * Adds an element at the end of this container.
130   *
131   * @param { T } element - Target element.
132   * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
133   * @throws { BusinessError } 10200011 - The add method cannot be bound.
134   * @syscap SystemCapability.Utils.Lang
135   * @crossplatform
136   * @atomicservice
137   * @since arkts {'1.1':'12', '1.2':'20'}
138   * @arkts 1.1&1.2
139   */
140  add(element: T): boolean;
141  /**
142   * Inserts the specified element at the specified position in this
143   * arraylist. Shifts the element currently at that position (if any) and
144   * any subsequent elements to the right (adds one to their index).
145   *
146   * @param { T } element - element element element to be inserted
147   * @param { number } index - index index at which the specified element is to be inserted
148   * @throws { BusinessError } 10200001 - The value of index is out of range.
149   * @throws { BusinessError } 10200011 - The insert method cannot be bound.
150   * @throws { BusinessError } 401 - Parameter error. Possible causes:
151   * 1.Mandatory parameters are left unspecified;
152   * 2.Incorrect parameter types;
153   * 3.Parameter verification failed.
154   * @syscap SystemCapability.Utils.Lang
155   * @since 8
156   */
157  /**
158   * Inserts the specified element at the specified position in this
159   * arraylist. Shifts the element currently at that position (if any) and
160   * any subsequent elements to the right (adds one to their index).
161   *
162   * @param { T } element - element element element to be inserted
163   * @param { number } index - index index at which the specified element is to be inserted
164   * @throws { BusinessError } 10200001 - The value of index is out of range.
165   * @throws { BusinessError } 10200011 - The insert method cannot be bound.
166   * @throws { BusinessError } 401 - Parameter error. Possible causes:
167   * 1.Mandatory parameters are left unspecified;
168   * 2.Incorrect parameter types;
169   * 3.Parameter verification failed.
170   * @syscap SystemCapability.Utils.Lang
171   * @crossplatform
172   * @since 10
173   */
174  /**
175   * Inserts an element at the specified position in this container.
176   *
177   * @param { T } element - Target element.
178   * @param { number } index - Index of the position where the element is to be inserted.
179   * @throws { BusinessError } 10200001 - The value of index is out of range.
180   * @throws { BusinessError } 10200011 - The insert method cannot be bound.
181   * @throws { BusinessError } 401 - Parameter error. Possible causes:
182   * 1.Mandatory parameters are left unspecified;
183   * 2.Incorrect parameter types;
184   * 3.Parameter verification failed.
185   * @syscap SystemCapability.Utils.Lang
186   * @crossplatform
187   * @atomicservice
188   * @since arkts {'1.1':'12', '1.2':'20'}
189   * @arkts 1.1&1.2
190   */
191  insert(element: T, index: number): void;
192  /**
193   * Check if arraylist contains the specified element
194   *
195   * @param { T } element - element element element to be contained
196   * @returns { boolean } the boolean type,if arraylist contains the specified element,return true,else return false
197   * @throws { BusinessError } 10200011 - The has method cannot be bound.
198   * @syscap SystemCapability.Utils.Lang
199   * @since 8
200   */
201  /**
202   * Check if arraylist contains the specified element
203   *
204   * @param { T } element - element element element to be contained
205   * @returns { boolean } the boolean type,if arraylist contains the specified element,return true,else return false
206   * @throws { BusinessError } 10200011 - The has method cannot be bound.
207   * @syscap SystemCapability.Utils.Lang
208   * @crossplatform
209   * @since 10
210   */
211  /**
212   * Checks whether this container has the specified element.
213   *
214   * @param { T } element - Target element.
215   * @returns { boolean } the boolean type,if arraylist contains the specified element,return true,else return false
216   * @throws { BusinessError } 10200011 - The has method cannot be bound.
217   * @syscap SystemCapability.Utils.Lang
218   * @crossplatform
219   * @atomicservice
220   * @since arkts {'1.1':'12', '1.2':'20'}
221   * @arkts 1.1&1.2
222   */
223  has(element: T): boolean;
224  /**
225   * Returns the index of the first occurrence of the specified element
226   * in this arraylist, or -1 if this arraylist does not contain the element.
227   *
228   * @param { T } element - element element element to be contained
229   * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
230   * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
231   * @syscap SystemCapability.Utils.Lang
232   * @since 8
233   */
234  /**
235   * Returns the index of the first occurrence of the specified element
236   * in this arraylist, or -1 if this arraylist does not contain the element.
237   *
238   * @param { T } element - element element element to be contained
239   * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
240   * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
241   * @syscap SystemCapability.Utils.Lang
242   * @crossplatform
243   * @since 10
244   */
245  /**
246   * Obtains the index of the first occurrence of the specified element in this container.
247   *
248   * @param { T } element - Target element.
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   * @crossplatform
253   * @atomicservice
254   * @since arkts {'1.1':'12', '1.2':'20'}
255   * @arkts 1.1&1.2
256   */
257  getIndexOf(element: T): number;
258  /**
259   * Find the corresponding element according to the index,
260   * delete the element, and move the index of all elements to the right of the element forward by one.
261   *
262   * @param { number } index - index index the index in the arraylist
263   * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is
264   * @throws { BusinessError } 10200001 - The value of index is out of range.
265   * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
266   * @throws { BusinessError } 401 - Parameter error. Possible causes:
267   * 1.Mandatory parameters are left unspecified;
268   * 2.Incorrect parameter types;
269   * 3.Parameter verification failed.
270   * @syscap SystemCapability.Utils.Lang
271   * @since 8
272   */
273  /**
274   * Find the corresponding element according to the index,
275   * delete the element, and move the index of all elements to the right of the element forward by one.
276   *
277   * @param { number } index - index index the index in the arraylist
278   * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is
279   * @throws { BusinessError } 10200001 - The value of index is out of range.
280   * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
281   * @throws { BusinessError } 401 - Parameter error. Possible causes:
282   * 1.Mandatory parameters are left unspecified;
283   * 2.Incorrect parameter types;
284   * 3.Parameter verification failed.
285   * @syscap SystemCapability.Utils.Lang
286   * @crossplatform
287   * @since 10
288   */
289  /**
290   * Removes an element with the specified position from this container.
291   *
292   * @param { number } index - Position index of the target element.
293   * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is
294   * @throws { BusinessError } 10200001 - The value of "index" is out of range.
295   * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
296   * @throws { BusinessError } 401 - Parameter error. Possible causes:
297   * 1.Mandatory parameters are left unspecified;
298   * 2.Incorrect parameter types;
299   * 3.Parameter verification failed.
300   * @syscap SystemCapability.Utils.Lang
301   * @crossplatform
302   * @atomicservice
303   * @since arkts {'1.1':'12', '1.2':'20'}
304   * @arkts 1.1&1.2
305   */
306  removeByIndex(index: number): T;
307  /**
308   * Removes the first occurrence of the specified element from this arraylist,
309   * if it is present.  If the arraylist does not contain the element, it is
310   * unchanged.  More formally, removes the element with the lowest index
311   *
312   * @param { T } element - element element element to remove
313   * @returns { boolean } the boolean type ,If there is no such element, return false
314   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
315   * @syscap SystemCapability.Utils.Lang
316   * @since 8
317   */
318  /**
319   * Removes the first occurrence of the specified element from this arraylist,
320   * if it is present.  If the arraylist does not contain the element, it is
321   * unchanged.  More formally, removes the element with the lowest index
322   *
323   * @param { T } element - element element element to remove
324   * @returns { boolean } the boolean type ,If there is no such element, return false
325   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
326   * @syscap SystemCapability.Utils.Lang
327   * @crossplatform
328   * @since 10
329   */
330  /**
331   * Removes the first occurrence of the specified element from this container.
332   *
333   * @param { T } element - Target element.
334   * @returns { boolean } the boolean type ,If there is no such element, return false
335   * @throws { BusinessError } 10200011 - The remove method cannot be bound.
336   * @syscap SystemCapability.Utils.Lang
337   * @crossplatform
338   * @atomicservice
339   * @since arkts {'1.1':'12', '1.2':'20'}
340   * @arkts 1.1&1.2
341   */
342  remove(element: T): boolean;
343  /**
344   * Returns in the index of the last occurrence of the specified element in this arraylist ,
345   * or -1 if the arraylist does not contain the element.
346   *
347   * @param { T } element - element element element to find
348   * @returns { number } the number type
349   * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
350   * @syscap SystemCapability.Utils.Lang
351   * @since 8
352   */
353  /**
354   * Returns in the index of the last occurrence of the specified element in this arraylist ,
355   * or -1 if the arraylist does not contain the element.
356   *
357   * @param { T } element - element element element to find
358   * @returns { number } the number type
359   * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
360   * @syscap SystemCapability.Utils.Lang
361   * @crossplatform
362   * @since 10
363   */
364  /**
365   * Obtains the index of the last occurrence of the specified element in this container.
366   *
367   * @param { T } element - Target element.
368   * @returns { number } the number type
369   * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
370   * @syscap SystemCapability.Utils.Lang
371   * @crossplatform
372   * @atomicservice
373   * @since arkts {'1.1':'12', '1.2':'20'}
374   * @arkts 1.1&1.2
375   */
376  getLastIndexOf(element: T): number;
377  /**
378   * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive.
379   *
380   * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
381   * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
382   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
383   * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound.
384   * @throws { BusinessError } 401 - Parameter error. Possible causes:
385   * 1.Mandatory parameters are left unspecified;
386   * 2.Incorrect parameter types;
387   * 3.Parameter verification failed.
388   * @syscap SystemCapability.Utils.Lang
389   * @since 8
390   */
391  /**
392   * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive.
393   *
394   * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
395   * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
396   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
397   * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound.
398   * @throws { BusinessError } 401 - Parameter error. Possible causes:
399   * 1.Mandatory parameters are left unspecified;
400   * 2.Incorrect parameter types;
401   * 3.Parameter verification failed.
402   * @syscap SystemCapability.Utils.Lang
403   * @crossplatform
404   * @since 10
405   */
406  /**
407   * Removes from this container all of the elements within a range, including the element at the start position but
408   * not that at the end position.
409   *
410   * @param { number } fromIndex - Index of the start position.
411   * @param { number } toIndex - Index of the end position.
412   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
413   * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound.
414   * @throws { BusinessError } 401 - Parameter error. Possible causes:
415   * 1.Mandatory parameters are left unspecified;
416   * 2.Incorrect parameter types;
417   * 3.Parameter verification failed.
418   * @syscap SystemCapability.Utils.Lang
419   * @crossplatform
420   * @atomicservice
421   * @since arkts {'1.1':'12', '1.2':'20'}
422   * @arkts 1.1&1.2
423   */
424  removeByRange(fromIndex: number, toIndex: number): void;
425  /**
426   * Replaces each element of this arraylist with the result of applying the operator to that element.
427   *
428   * @param { function } callbackFn - callbackFn
429   * callbackFn (required) A function that accepts up to three arguments.
430   * The function to be called for each element.
431   * @param { Object } [thisArg] - thisArg
432   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
433   * If thisArg is omitted, undefined is used as the this value.
434   * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
435   * @throws { BusinessError } 401 - Parameter error. Possible causes:
436   * 1.Mandatory parameters are left unspecified;
437   * 2.Incorrect parameter types.
438   * @syscap SystemCapability.Utils.Lang
439   * @since 8
440   */
441  /**
442   * Replaces each element of this arraylist with the result of applying the operator to that element.
443   *
444   * @param { function } callbackFn - callbackFn
445   * callbackFn (required) A function that accepts up to three arguments.
446   * The function to be called for each element.
447   * @param { Object } [thisArg] - thisArg
448   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
449   * If thisArg is omitted, undefined is used as the this value.
450   * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
451   * @throws { BusinessError } 401 - Parameter error. Possible causes:
452   * 1.Mandatory parameters are left unspecified;
453   * 2.Incorrect parameter types.
454   * @syscap SystemCapability.Utils.Lang
455   * @crossplatform
456   * @since 10
457   */
458  /**
459   * Replaces all elements in this container with new elements, and returns the new ones.
460   *
461   * @param { function } callbackFn - Callback invoked for the replacement.
462   * @param { Object } [thisArg] - Value of this to use when callbackFn is invoked. The default value is this instance.
463   * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
464   * @throws { BusinessError } 401 - Parameter error. Possible causes:
465   * 1.Mandatory parameters are left unspecified;
466   * 2.Incorrect parameter types.
467   * @syscap SystemCapability.Utils.Lang
468   * @crossplatform
469   * @atomicservice
470   * @since 12
471   */
472  replaceAllElements(callbackFn: (value: T, index?: number, arrlist?: ArrayList<T>) => T, thisArg?: Object): void;
473
474  /**
475   * Replaces all elements in this container with new elements, and returns the new ones.
476   *
477   * @param { ArrayListCbFn1<T> } callbackFn - Callback invoked for the replacement.
478   * @syscap SystemCapability.Utils.Lang
479   * @crossplatform
480   * @atomicservice
481   * @since 20
482   * @arkts 1.2
483   */
484  replaceAllElements(callbackFn: ArrayListCbFn1<T>): void;
485
486  /**
487   * Executes a provided function once for each value in the arraylist object.
488   *
489   * @param { function } callbackFn - callbackFn
490   * callbackFn (required) A function that accepts up to three arguments.
491   * The function to be called for each element.
492   * @param { Object } [thisArg] - thisArg
493   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
494   * If thisArg is omitted, undefined is used as the this value.
495   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
496   * @throws { BusinessError } 401 - Parameter error. Possible causes:
497   * 1.Mandatory parameters are left unspecified;
498   * 2.Incorrect parameter types.
499   * @syscap SystemCapability.Utils.Lang
500   * @since 8
501   */
502  /**
503   * Executes a provided function once for each value in the arraylist object.
504   *
505   * @param { function } callbackFn - callbackFn
506   * callbackFn (required) A function that accepts up to three arguments.
507   * The function to be called for each element.
508   * @param { Object } [thisArg] - thisArg
509   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
510   * If thisArg is omitted, undefined is used as the this value.
511   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
512   * @throws { BusinessError } 401 - Parameter error. Possible causes:
513   * 1.Mandatory parameters are left unspecified;
514   * 2.Incorrect parameter types.
515   * @syscap SystemCapability.Utils.Lang
516   * @crossplatform
517   * @since 10
518   */
519  /**
520   * Executes a provided function once for each value in the arraylist object.
521   *
522   * @param { function } callbackFn - callbackFn
523   * callbackFn (required) A function that accepts up to three arguments.
524   * The function to be called for each element.
525   * @param { Object } [thisArg] - thisArg
526   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
527   * If thisArg is omitted, undefined is used as the this value.
528   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
529   * @throws { BusinessError } 401 - Parameter error. Possible causes:
530   * 1.Mandatory parameters are left unspecified;
531   * 2.Incorrect parameter types.
532   * @syscap SystemCapability.Utils.Lang
533   * @crossplatform
534   * @atomicservice
535   * @since 12
536   */
537  forEach(callbackFn: (value: T, index?: number, arrlist?: ArrayList<T>) => void, thisArg?: Object): void;
538
539  /**
540   * Iterates over elements in a generic ArrayList and executes a callback function for each element.
541   *
542   * @param { ArrayListCbFn<T> } callbackFn - A callback function to execute for each element.
543   * @syscap SystemCapability.Utils.Lang
544   * @crossplatform
545   * @atomicservice
546   * @since 20
547   * @arkts 1.2
548   */
549  forEach(callbackFn: ArrayListCbFn<T>): void;
550
551  /**
552   * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter,
553   * it will default to ASCII sorting
554   *
555   * @param { function } [comparator] - comparator
556   * comparator (Optional) A function that accepts up to two arguments.Specifies the sort order.
557   * Must be a function,return number type,If it returns firstValue minus secondValue, it returns an arraylist
558   * sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order;
559   * If this parameter is empty, it will default to ASCII sorting
560   * @throws { BusinessError } 10200011 - The sort method cannot be bound.
561   * @throws { BusinessError } 401 - Parameter error. Possible causes:
562   * 1.Incorrect parameter types;
563   * 2.Parameter verification failed.
564   * @syscap SystemCapability.Utils.Lang
565   * @since 8
566   */
567  /**
568   * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter,
569   * it will default to ASCII sorting
570   *
571   * @param { function } [comparator] - comparator
572   * comparator (Optional) A function that accepts up to two arguments.Specifies the sort order.
573   * Must be a function,return number type,If it returns firstValue minus secondValue, it returns an arraylist
574   * sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order;
575   * If this parameter is empty, it will default to ASCII sorting
576   * @throws { BusinessError } 10200011 - The sort method cannot be bound.
577   * @throws { BusinessError } 401 - Parameter error. Possible causes:
578   * 1.Incorrect parameter types;
579   * 2.Parameter verification failed.
580   * @syscap SystemCapability.Utils.Lang
581   * @crossplatform
582   * @since 10
583   */
584  /**
585   * Sorts elements in this container.
586   *
587   * @param { function } [comparator] - Callback invoked for sorting. The default value is the callback function for
588   * sorting elements in ascending order.
589   * @throws { BusinessError } 10200011 - The sort method cannot be bound.
590   * @throws { BusinessError } 401 - Parameter error. Possible causes:
591   * 1.Incorrect parameter types;
592   * 2.Parameter verification failed.
593   * @syscap SystemCapability.Utils.Lang
594   * @crossplatform
595   * @atomicservice
596   * @since arkts {'1.1':'12', '1.2':'20'}
597   * @arkts 1.1&1.2
598   */
599  sort(comparator?: (firstValue: T, secondValue: T) => number): void;
600  /**
601   * Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive
602   *
603   * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
604   * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
605   * @returns { ArrayList<T> }
606   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
607   * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound.
608   * @throws { BusinessError } 401 - Parameter error. Possible causes:
609   * 1.Mandatory parameters are left unspecified;
610   * 2.Incorrect parameter types;
611   * 3.Parameter verification failed.
612   * @syscap SystemCapability.Utils.Lang
613   * @since 8
614   */
615  /**
616   * Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive
617   *
618   * @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
619   * @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
620   * @returns { ArrayList<T> }
621   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
622   * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound.
623   * @throws { BusinessError } 401 - Parameter error. Possible causes:
624   * 1.Mandatory parameters are left unspecified;
625   * 2.Incorrect parameter types;
626   * 3.Parameter verification failed.
627   * @syscap SystemCapability.Utils.Lang
628   * @crossplatform
629   * @since 10
630   */
631  /**
632   * Obtains elements within a range in this container, including the element at the start position but not that at the
633   * end position, and returns these elements as a new ArrayList instance.
634   *
635   * @param { number } fromIndex - Index of the start position.
636   * @param { number } toIndex - Index of the end position.
637   * @returns { ArrayList<T> }
638   * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
639   * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound.
640   * @throws { BusinessError } 401 - Parameter error. Possible causes:
641   * 1.Mandatory parameters are left unspecified;
642   * 2.Incorrect parameter types;
643   * 3.Parameter verification failed.
644   * @syscap SystemCapability.Utils.Lang
645   * @crossplatform
646   * @atomicservice
647   * @since arkts {'1.1':'12', '1.2':'20'}
648   * @arkts 1.1&1.2
649   */
650  subArrayList(fromIndex: number, toIndex: number): ArrayList<T>;
651  /**
652   * Removes all of the elements from this arraylist.The arraylist will
653   * be empty after this call returns.length becomes 0
654   *
655   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
656   * @syscap SystemCapability.Utils.Lang
657   * @since 8
658   */
659  /**
660   * Removes all of the elements from this arraylist.The arraylist will
661   * be empty after this call returns.length becomes 0
662   *
663   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
664   * @syscap SystemCapability.Utils.Lang
665   * @crossplatform
666   * @since 10
667   */
668  /**
669   * Clears this container and sets its length to 0.
670   *
671   * @throws { BusinessError } 10200011 - The clear method cannot be bound.
672   * @syscap SystemCapability.Utils.Lang
673   * @crossplatform
674   * @atomicservice
675   * @since arkts {'1.1':'12', '1.2':'20'}
676   * @arkts 1.1&1.2
677   */
678  clear(): void;
679  /**
680   * Returns a shallow copy of this instance. (The elements themselves are not copied.)
681   *
682   * @returns { ArrayList<T> } this arraylist instance
683   * @throws { BusinessError } 10200011 - The clone method cannot be bound.
684   * @syscap SystemCapability.Utils.Lang
685   * @since 8
686   */
687  /**
688   * Returns a shallow copy of this instance. (The elements themselves are not copied.)
689   *
690   * @returns { ArrayList<T> } this arraylist instance
691   * @throws { BusinessError } 10200011 - The clone method cannot be bound.
692   * @syscap SystemCapability.Utils.Lang
693   * @crossplatform
694   * @since 10
695   */
696  /**
697   * Clones this container and returns a copy. The modification to the copy does not affect the original instance.
698   *
699   * @returns { ArrayList<T> } this arraylist instance
700   * @throws { BusinessError } 10200011 - The clone method cannot be bound.
701   * @syscap SystemCapability.Utils.Lang
702   * @crossplatform
703   * @atomicservice
704   * @since arkts {'1.1':'12', '1.2':'20'}
705   * @arkts 1.1&1.2
706   */
707  clone(): ArrayList<T>;
708  /**
709   * returns the capacity of this arraylist
710   *
711   * @returns { number } the number type
712   * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound.
713   * @syscap SystemCapability.Utils.Lang
714   * @since 8
715   */
716  /**
717   * returns the capacity of this arraylist
718   *
719   * @returns { number } the number type
720   * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound.
721   * @syscap SystemCapability.Utils.Lang
722   * @crossplatform
723   * @since 10
724   */
725  /**
726   * Obtains the capacity of this container.
727   *
728   * @returns { number } the number type
729   * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound.
730   * @syscap SystemCapability.Utils.Lang
731   * @crossplatform
732   * @atomicservice
733   * @since arkts {'1.1':'12', '1.2':'20'}
734   * @arkts 1.1&1.2
735   */
736  getCapacity(): number;
737  /**
738   * convert arraylist to array
739   *
740   * @returns { Array<T> } the Array type
741   * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
742   * @syscap SystemCapability.Utils.Lang
743   * @since 8
744   */
745  /**
746   * convert arraylist to array
747   *
748   * @returns { Array<T> } the Array type
749   * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
750   * @syscap SystemCapability.Utils.Lang
751   * @crossplatform
752   * @since 10
753   */
754  /**
755   * Converts this container into an array.
756   *
757   * @returns { Array<T> } the Array type
758   * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
759   * @syscap SystemCapability.Utils.Lang
760   * @crossplatform
761   * @atomicservice
762   * @since arkts {'1.1':'12', '1.2':'20'}
763   * @arkts 1.1&1.2
764   */
765  convertToArray(): Array<T>;
766  /**
767   * Determine whether arraylist is empty and whether there is an element
768   *
769   * @returns { boolean } the boolean type
770   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
771   * @syscap SystemCapability.Utils.Lang
772   * @since 8
773   */
774  /**
775   * Determine whether arraylist is empty and whether there is an element
776   *
777   * @returns { boolean } the boolean type
778   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
779   * @syscap SystemCapability.Utils.Lang
780   * @crossplatform
781   * @since 10
782   */
783  /**
784   * Checks whether this container is empty (contains no element).
785   *
786   * @returns { boolean } the boolean type
787   * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
788   * @syscap SystemCapability.Utils.Lang
789   * @crossplatform
790   * @atomicservice
791   * @since arkts {'1.1':'12', '1.2':'20'}
792   * @arkts 1.1&1.2
793   */
794  isEmpty(): boolean;
795  /**
796   * Returns the element at the given index.
797   *
798   * @param { number } index - Index. The value must be less than or equal to int32_max, that is, 2147483647.
799   * @returns { T } The element in the arraylist matching the given index.
800   * @throws { BusinessError } 401 - Parameter error.
801   * @throws { BusinessError } 10200001 - The value of index is out of range.
802   * @syscap SystemCapability.Utils.Lang
803   * @atomicservice
804   * @since 12
805   */
806  [index: number]: T;
807
808  /**
809   * Returns the item at that index.
810   *
811   * @param { number } index - The zero-based index of the desired code unit.
812   * @returns { T } The element in the arrayList matching the given index.
813   * @throws { BusinessError } 10200001 - The value of index is out of range.
814   * @syscap SystemCapability.Utils.Lang
815   * @atomicservice
816   * @since 20
817   * @arkts 1.2
818   */
819  $_get(index: number): T;
820
821  /**
822   * Set the value of item at that index.
823   *
824   * @param { number } index - The index of the element to set.
825   * @param { T } value - The value to set at the specified index.
826   * @throws { BusinessError } 10200001 - The value of index is out of range.
827   * @syscap SystemCapability.Utils.Lang
828   * @atomicservice
829   * @since 20
830   * @arkts 1.2
831   */
832  $_set(index: number, value: T): void;
833
834  /**
835   * If the newCapacity provided by the user is greater than or equal to length,
836   * change the capacity of the arraylist to newCapacity, otherwise the capacity will not be changed
837   *
838   * @param { number } newCapacity - newCapacity newCapacity
839   * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
840   * @throws { BusinessError } 401 - Parameter error. Possible causes:
841   * 1.Mandatory parameters are left unspecified;
842   * 2.Incorrect parameter types.
843   * @syscap SystemCapability.Utils.Lang
844   * @since 8
845   */
846  /**
847   * If the newCapacity provided by the user is greater than or equal to length,
848   * change the capacity of the arraylist to newCapacity, otherwise the capacity will not be changed
849   *
850   * @param { number } newCapacity - newCapacity newCapacity
851   * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
852   * @throws { BusinessError } 401 - Parameter error. Possible causes:
853   * 1.Mandatory parameters are left unspecified;
854   * 2.Incorrect parameter types.
855   * @syscap SystemCapability.Utils.Lang
856   * @crossplatform
857   * @since 10
858   */
859  /**
860   * Increases the capacity of this container.
861   *
862   * @param { number } newCapacity - New capacity.
863   * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
864   * @throws { BusinessError } 401 - Parameter error. Possible causes:
865   * 1.Mandatory parameters are left unspecified;
866   * 2.Incorrect parameter types.
867   * @syscap SystemCapability.Utils.Lang
868   * @crossplatform
869   * @atomicservice
870   * @since arkts {'1.1':'12', '1.2':'20'}
871   * @arkts 1.1&1.2
872   */
873  increaseCapacityTo(newCapacity: number): void;
874  /**
875   * Limit the capacity to the current length
876   *
877   * @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound.
878   * @syscap SystemCapability.Utils.Lang
879   * @since 8
880   */
881  /**
882   * Limit the capacity to the current length
883   *
884   * @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound.
885   * @syscap SystemCapability.Utils.Lang
886   * @crossplatform
887   * @since 10
888   */
889  /**
890   * Releases the reserved space in this container by adjusting the container capacity to the actual number of elements
891   * in this container.
892   *
893   * @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound.
894   * @syscap SystemCapability.Utils.Lang
895   * @crossplatform
896   * @atomicservice
897   * @since arkts {'1.1':'12', '1.2':'20'}
898   * @arkts 1.1&1.2
899   */
900  trimToCurrentLength(): void;
901  /**
902   * returns an iterator.Each item of the iterator is a Javascript Object
903   *
904   * @returns { IterableIterator<T> }
905   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
906   * @syscap SystemCapability.Utils.Lang
907   * @since 8
908   */
909  /**
910   * returns an iterator.Each item of the iterator is a Javascript Object
911   *
912   * @returns { IterableIterator<T> }
913   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
914   * @syscap SystemCapability.Utils.Lang
915   * @crossplatform
916   * @since 10
917   */
918  /**
919   * Obtains an iterator, each item of which is a JavaScript object.
920   *
921   * @returns { IterableIterator<T> }
922   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
923   * @syscap SystemCapability.Utils.Lang
924   * @crossplatform
925   * @atomicservice
926   * @since 12
927   */
928  [Symbol.iterator](): IterableIterator<T>;
929
930  /**
931   * Obtains an iterator, each item of which is a JavaScript object.
932   *
933   * @returns { IterableIterator<T> }
934   * @syscap SystemCapability.Utils.Lang
935   * @crossplatform
936   * @atomicservice
937   * @since 20
938   * @arkts 1.2
939   */
940  $_iterator(): IterableIterator<T>;
941}
942
943  /**
944   * The type of ArrayList callback function.
945   *
946   * @typedef { function } ArrayListCbFn
947   * @param { T } value - The current element being processed
948   * @param { number } index - The index of the current element
949   * @param { ArrayList<T> } arrlist - The ArrayList instance being traversed
950   * @returns { void } This callback does not return a value
951   * @syscap SystemCapability.Utils.Lang
952   * @atomicservice
953   * @since 20
954   * @arkts 1.2
955   */
956  type ArrayListCbFn<T> =  (value: T, index: number, arrlist: ArrayList<T>) => void;
957
958  /**
959   * The type of ArrayList callback function.
960   *
961   * @typedef { function } ArrayListCbFn
962   * @param { T } value - The current element being processed
963   * @param { number } [index] - The index of the current element
964   * @param { ArrayList<T> } [arrlist] - The ArrayList instance being traversed
965   * @returns { T } This callback does not return a value
966   * @syscap SystemCapability.Utils.Lang
967   * @atomicservice
968   * @since 20
969   * @arkts 1.2
970   */
971  type ArrayListCbFn1<T> =  (value: T, index?: number, arrlist?: ArrayList<T>) => T;
972
973export default ArrayList;
974