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