46 Star 173 Fork 4.7K

OpenHarmony/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.util.List.d.ts 38.99 KB
一键复制 编辑 原始数据 按行查看 历史
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit ArkTS
*/
/**
* List is implemented based on the singly linked list. Each node has a reference pointing to the next element.
* When querying an element, the system traverses the list from the beginning.
*
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* List is implemented based on the singly linked list. Each node has a reference pointing to the next element.
* When querying an element, the system traverses the list from the beginning.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* List is implemented based on the singly linked list. Each node has a reference pointing to the next element.
* When querying an element, the system traverses the list from the beginning. List offers efficient insertion
* and removal operations but supports low query efficiency. List allows null elements.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
declare class List<T> {
/**
* A constructor used to create a List object.
*
* @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* A constructor used to create a List object.
*
* @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* A constructor used to create a List instance.
*
* @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
constructor();
/**
* Gets the element number of the List. This is a number one higher than the highest index in the list.
*
* @type { number }
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Gets the element number of the List. This is a number one higher than the highest index in the list.
*
* @type { number }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Number of elements in a list.
*
* @type { number }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
length: number;
/**
* Gets the element number of the List.
*
* @type { number }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
get length(): number;
/**
* Appends the specified element to the end of this list.
*
* @param { T } element - element element to be appended to this list
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Appends the specified element to the end of this list.
*
* @param { T } element - element element to be appended to this list
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Adds an element at the end of this container.
*
* @param { T } element - Target element.
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
add(element: T): boolean;
/**
* Inserts the specified element at the specified position in this list.
*
* @param { T } element - element element element to be inserted
* @param { number } index - index index index at which the specified element is to be inserted
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types;
* 3.Parameter verification failed.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Inserts the specified element at the specified position in this list.
*
* @param { T } element - element element element to be inserted
* @param { number } index - index index index at which the specified element is to be inserted
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types;
* 3.Parameter verification failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Inserts an element at the specified position in this container.
*
* @param { T } element - Target element.
* @param { number } index - Index of the position where the element is to be inserted.
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types;
* 3.Parameter verification failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
insert(element: T, index: number): void;
/**
* Returns the element at the specified position in this list,
* or returns undefined if this list is empty
*
* @param { number } index - index index specified position
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns the element at the specified position in this list,
* or returns undefined if this list is empty
*
* @param { number } index - index index specified position
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains the element at the specified position in this container.
*
* @param { number } index - Position index of the target element.
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
get(index: number): T;
/**
* Returns the element at the specified position in this list,
* or returns undefined if this list is empty
*
* @param { number } index - specified position
* @returns { T | undefined} the element at the specified index, or undefined if the index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
get(index: number): T | undefined;
/**
* Check if list contains the specified element
*
* @param { T } element - element element element to be contained
* @returns { boolean } the boolean type,if list contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Check if list contains the specified element
*
* @param { T } element - element element element to be contained
* @returns { boolean } the boolean type,if list contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Checks whether this container has the specified element.
*
* @param { T } element - Target element.
* @returns { boolean } the boolean type,if list contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
has(element: T): boolean;
/**
* Returns the index of the first occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
*
* @param { T } element - element element element to be contained
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns the index of the first occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
*
* @param { T } element - element element element to be contained
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains the index of the last occurrence of the specified element in this container.
*
* @param { T } element - Target element.
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
getIndexOf(element: T): number;
/**
* Find the corresponding element according to the index.
*
* @param { number } index - index index the index in the list
* @returns { T } the T type ,returns undefined if list is empty,If the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Find the corresponding element according to the index.
*
* @param { number } index - index index the index in the list
* @returns { T } the T type ,returns undefined if list is empty,If the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Searches for an element based on its index and then removes it.
*
* @param { number } index - Position index of the target element.
* @returns { T } the T type ,returns undefined if list is empty,If the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
removeByIndex(index: number): T;
/**
* Searches for an element based on its index and then removes it.
*
* @param { number } index - Position index of the target element.
* @returns { T | undefined } the T type, if the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}.
* Received value is: ${index}
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
removeByIndex(index: number): T | undefined;
/**
* Removes the first occurrence of the specified element from this list,
* if it is present. If the list does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Removes the first occurrence of the specified element from this list,
* if it is present. If the list does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Removes the first occurrence of the specified element from this container.
*
* @param { T } element - Target element.
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
remove(element: T): boolean;
/**
* Returns in the index of the last occurrence of the specified element in this list ,
* or -1 if the list does not contain the element.
*
* @param { T } element - element element element to find
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns in the index of the last occurrence of the specified element in this list ,
* or -1 if the list does not contain the element.
*
* @param { T } element - element element element to find
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains the index of the last occurrence of the specified element in this container.
*
* @param { T } element - Target element.
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
getLastIndexOf(element: T): number;
/**
* Returns the first element (the item at index 0) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns the first element (the item at index 0) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains the first element in this container.
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
getFirst(): T;
/**
* Returns the Last element (the item at index length-1) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns the Last element (the item at index length-1) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains the last element in this container.
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
getLast(): T;
/**
* Obtains the first element in this container.
*
* @returns { T | undefined } the T type, returns undefined if list is empty
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
getFirst(): T | undefined;
/**
* Obtains the last element in this container.
*
* @returns { T | undefined } the T type, returns undefined if list is empty
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
getLast(): T | undefined;
/**
* Replaces the element at the specified position in this List with the specified element
*
* @param { number } index - index index index to find
* @param { T } element - element element replaced element
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Replaces the element at the specified position in this List with the specified element
*
* @param { number } index - index index index to find
* @param { T } element - element element replaced element
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Replaces an element at the specified position in this container with a given element.
*
* @param { number } index - Position index of the target element.
* @param { T } element - Element to be used for replacement.
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
set(index: number, element: T): T;
/**
* Replaces an element at the specified position in this container with a given element.
*
* @param { number } index - Position index of the target element.
* @param { T } element - Element to be used for replacement.
* @returns { T | undefined } the T type, returns undefined if linkedList is empty
* @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}.
* Received value is: ${index}
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
set(index: number, element: T): T | undefined;
/**
* Compares the specified object with this list for equality.if the object are the same as this list
* return true, otherwise return false.
*
* @param { Object } obj - obj obj Compare objects
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Compares the specified object with this list for equality.if the object are the same as this list
* return true, otherwise return false.
*
* @param { Object } obj - obj obj Compare objects
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Compares whether a specified object is equal to this container.
*
* @param { Object } obj - Object used for comparison.
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
equal(obj: Object): boolean;
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { function } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to three arguments.
* The function to be called for each element.
* @param { Object } [thisArg] - thisArg
* thisArg (Optional) The value to be used as this value for when callbackFn is called.
* If thisArg is omitted, undefined is used as the this value.
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { function } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to three arguments.
* The function to be called for each element.
* @param { Object } [thisArg] - thisArg
* thisArg (Optional) The value to be used as this value for when callbackFn is called.
* If thisArg is omitted, undefined is used as the this value.
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Uses a callback to traverse the elements in this container and obtain their position indexes.
*
* @param { function } callbackFn - Callback invoked for the replacement.
* @param { Object } [thisArg] - Value of this to use when callbackFn is invoked. The default value is this instance.
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
forEach(callbackFn: (value: T, index?: number, List?: List<T>) => void, thisArg?: Object): void;
/**
* Uses a callback to traverse the elements in this container and obtain their position indexes.
*
* @param { ListForEachCb } callbackFn - Callback invoked for the replacement.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
forEach(callbackfn: ListForEachCb<T>): void;
/**
* Sorts this list according to the order induced by the specified comparator
*
* @param { function } comparator - comparator
* comparator (required) A function that accepts up to two arguments.
* Specifies the sort order. Must be a function,return number type,If it returns firstValue
* minus secondValue, it returns an list sorted in ascending order;If it returns secondValue
* minus firstValue, it returns an list sorted in descending order;
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Sorts this list according to the order induced by the specified comparator
*
* @param { function } comparator - comparator
* comparator (required) A function that accepts up to two arguments.
* Specifies the sort order. Must be a function,return number type,If it returns firstValue
* minus secondValue, it returns an list sorted in ascending order;If it returns secondValue
* minus firstValue, it returns an list sorted in descending order;
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Sorts elements in this container.
*
* @param { function } comparator - Callback invoked for sorting.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
sort(comparator: (firstValue: T, secondValue: T) => number): void;
/**
* Removes all of the elements from this list.The list will
* be empty after this call returns.length becomes 0
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Removes all of the elements from this list.The list will
* be empty after this call returns.length becomes 0
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Clears this container and sets its length to 0.
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
clear(): void;
/**
* Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive
*
* @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
* @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
* @returns { List<T> }
* @throws { BusinessError } 10200011 - The getSubList method cannot be bound.
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive
*
* @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
* @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
* @returns { List<T> }
* @throws { BusinessError } 10200011 - The getSubList method cannot be bound.
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains elements within a range in this container, including the element at the start position but not that at the
* end position, and returns these elements as a new List instance.
*
* @param { number } fromIndex - Index of the start position.
* @param { number } toIndex - Index of the end position.
* @returns { List<T> }
* @throws { BusinessError } 10200011 - The getSubList method cannot be bound.
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
getSubList(fromIndex: number, toIndex: number): List<T>;
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { function } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to three arguments.
* The function to be called for each element.
* @param { Object } [thisArg] - thisArg
* thisArg (Optional) The value to be used as this value for when callbackFn is called.
* If thisArg is omitted, undefined is used as the this value.
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { function } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to three arguments.
* The function to be called for each element.
* @param { Object } [thisArg] - thisArg
* thisArg (Optional) The value to be used as this value for when callbackFn is called.
* If thisArg is omitted, undefined is used as the this value.
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Replaces all elements in this container with new elements, and returns the new ones.
* @param { function } callbackFn - Callback invoked for the replacement.
* @param { Object } [thisArg] - Value of this to use when callbackFn is invoked. The default value is this instance.
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
replaceAllElements(callbackFn: (value: T, index?: number, list?: List<T>) => T, thisArg?: Object): void;
/**
* Replaces all elements in this container with new elements, and returns the new ones.
*
* @param { ListReplaceCb } callbackFn - Callback invoked for the replacement.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
replaceAllElements(callbackfn: ListReplaceCb<T>): void;
/**
* convert list to array
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* convert list to array
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Converts this container into an array.
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
convertToArray(): Array<T>;
/**
* Determine whether list is empty and whether there is an element
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* Determine whether list is empty and whether there is an element
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Checks whether this container is empty (contains no element).
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
isEmpty(): boolean;
/**
* Returns the item at that index
*
* @param { number } index - the zero-based index of the desired code unit.
* @returns { T | undefined } the element in the list matching the given index,
* or undefined if the index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
$_get(index: number): T | undefined;
/**
* Set the value of item at that index.
*
* @param { number } index – the index of the element to set.
* @param { T } value – the value to set at the specified index
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
$_set(index: number, value: T): void;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
/**
* Obtains an iterator, each item of which is a JavaScript object.
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
[Symbol.iterator](): IterableIterator<T>;
/**
* Obtains an iterator, each item of which is a JavaScript object.
*
* @returns { IterableIterator<T> }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.2
*/
$_iterator(): IterableIterator<T>;
}
/**
* The type of List callback function.
*
* @typedef { function } ListForEachCb
* @param { T } value - The value of current element
* @param { number } index - The index of current element
* @param { List<T> } list - The List instance being traversed
* @returns { void } This callback does not return a value
* @syscap SystemCapability.Utils.Lang
* @atomicservice
* @since 20
* @arkts 1.2
*/
type ListForEachCb<T> = (value: T, index: number, list: List<T>) => void
/**
* The type of List callback function.
*
* @typedef { function } LinkedListForEachCb
* @param { T } value - The old value of current element
* @param { number } index - The index of current element
* @param { List<T> } list - The List instance being traversed
* @returns { T } - The new value of current element
* @syscap SystemCapability.Utils.Lang
* @atomicservice
* @since 20
* @arkts 1.2
*/
type ListReplaceCb<T> = (value: T, index: number, list: List<T>) => T
export default List;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助