From 52a1ac1deb424b5227094758ed2ce1ed30146d20 Mon Sep 17 00:00:00 2001 From: chengyuli Date: Fri, 4 Jul 2025 10:31:36 +0800 Subject: [PATCH] https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICHR85 Signed-off-by: chengyuli Change-Id: I20af8e043c35142b9dcee0657f76436812ead7e8 --- api/@ohos.util.ArrayList.d.ts | 142 ++++++++++++++++++----------- api/@ohos.util.Deque.d.ts | 40 ++++---- api/@ohos.util.HashMap.d.ts | 4 +- api/@ohos.util.HashSet.d.ts | 4 +- api/@ohos.util.LightWeightMap.d.ts | 32 +++---- api/@ohos.util.LightWeightSet.d.ts | 20 ++-- api/@ohos.util.LinkedList.d.ts | 32 +++---- api/@ohos.util.List.d.ts | 87 ++++++++++++------ api/@ohos.util.PlainArray.d.ts | 58 ++++++------ api/@ohos.util.Queue.d.ts | 8 +- api/@ohos.util.Stack.d.ts | 12 +-- api/@ohos.util.TreeMap.d.ts | 8 +- api/@ohos.util.TreeSet.d.ts | 8 +- 13 files changed, 260 insertions(+), 195 deletions(-) diff --git a/api/@ohos.util.ArrayList.d.ts b/api/@ohos.util.ArrayList.d.ts index a294822a93..c06a75a213 100644 --- a/api/@ohos.util.ArrayList.d.ts +++ b/api/@ohos.util.ArrayList.d.ts @@ -98,14 +98,14 @@ declare class ArrayList { /** * Gets the element number of the ArrayList. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this arraylist. * @@ -177,7 +177,7 @@ declare class ArrayList { * any subsequent elements to the right (adds one to their index). * * @param { T } element - element element element to be inserted - * @param { number } index - index index at which the specified element is to be inserted + * @param { int } index - index index at which the specified element is to be inserted * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -190,7 +190,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Check if arraylist contains the specified element * @@ -249,7 +249,7 @@ declare class ArrayList { * in this arraylist, or -1 if this arraylist 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. + * @returns { int } the int 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 @@ -257,7 +257,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. @@ -293,7 +293,7 @@ declare class ArrayList { * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. * - * @param { number } index - index index the index in the arraylist + * @param { int } index - index index the index in the arraylist * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is * @throws { BusinessError } 10200001 - The value of "index" is out of range. * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. @@ -307,7 +307,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByIndex(index: number): T; + removeByIndex(index: int): T; /** * Removes the first occurrence of the specified element from this arraylist, * if it is present. If the arraylist does not contain the element, it is @@ -372,7 +372,7 @@ declare class ArrayList { * or -1 if the arraylist does not contain the element. * * @param { T } element - element element element to find - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -380,7 +380,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive. * @@ -413,8 +413,8 @@ declare class ArrayList { /** * Removes from this arraylist all of the elements whose index is between 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 + * @param { int } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position + * @param { int } toIndex - toIndex toIndex the end of the index, excluding the value at that index * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -427,7 +427,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByRange(fromIndex: number, toIndex: number): void; + removeByRange(fromIndex: int, toIndex: int): void; /** * Replaces each element of this arraylist with the result of applying the operator to that element. * @@ -607,10 +607,29 @@ declare class ArrayList { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ sort(comparator?: (firstValue: T, secondValue: T) => number): void; + /** + * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter, + * it will default to ASCII sorting + * + * @param { ComparatorFn } [comparator] - comparator + * comparator (Optional) 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 arraylist + * sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order; + * If this parameter is empty, it will default to ASCII sorting + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + sort(comparator?: ComparatorFn): void; /** * Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive * @@ -645,8 +664,8 @@ declare class ArrayList { /** * Returns a view of the portion of this arraylist 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 + * @param { int } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position + * @param { int } toIndex - toIndex toIndex the end of the index, excluding the value at that index * @returns { ArrayList } * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound. @@ -660,7 +679,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - subArrayList(fromIndex: number, toIndex: number): ArrayList; + subArrayList(fromIndex: int, toIndex: int): ArrayList; /** * Removes all of the elements from this arraylist.The arraylist will * be empty after this call returns.length becomes 0 @@ -739,7 +758,7 @@ declare class ArrayList { /** * returns the capacity of this arraylist * - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -747,7 +766,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getCapacity(): number; + getCapacity(): int; /** * convert arraylist to array * @@ -823,7 +842,7 @@ declare class ArrayList { /** * Returns the item at that index. * - * @param { number } index - The zero-based index of the desired code unit. + * @param { int } index - The zero-based index of the desired code unit. * @returns { T } The element in the arrayList matching the given index. * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -831,12 +850,12 @@ declare class ArrayList { * @since 20 * @arkts 1.2 */ - $_get(index: number): T; + $_get(index: int): T; /** * Set the value of item at that index. * - * @param { number } index - The index of the element to set. + * @param { int } index - The index of the element to set. * @param { T } value - The value to set at the specified index. * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -844,7 +863,7 @@ declare class ArrayList { * @since 20 * @arkts 1.2 */ - $_set(index: number, value: T): void; + $_set(index: int, value: T): void; /** * If the newCapacity provided by the user is greater than or equal to length, @@ -875,7 +894,7 @@ declare class ArrayList { * If the newCapacity provided by the user is greater than or equal to length, * change the capacity of the arraylist to newCapacity, otherwise the capacity will not be changed * - * @param { number } newCapacity - newCapacity newCapacity + * @param { int } newCapacity - newCapacity newCapacity * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -886,7 +905,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(newCapacity: number): void; + increaseCapacityTo(newCapacity: int): void; /** * Limit the capacity to the current length * @@ -955,34 +974,49 @@ declare class ArrayList { $_iterator(): IterableIterator; } - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListForEachCb - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { ArrayList } arrlist - The ArrayList instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - export type ArrayListForEachCb = (value: T, index: number, arrlist: ArrayList) => void; +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ComparatorFn = (firstValue: T, secondValue: T) => double; - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListReplaceCb - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { ArrayList } arrlist - The ArrayList instance being traversed - * @returns { T } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - export type ArrayListReplaceCb = (value: T, index: number, arrlist: ArrayList) => T; +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListForEachCb = (value: T, index: int, arrlist: ArrayList) => void; + +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListReplaceCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { T } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListReplaceCb = (value: T, index: int, arrlist: ArrayList) => T; export default ArrayList; diff --git a/api/@ohos.util.Deque.d.ts b/api/@ohos.util.Deque.d.ts index 73f2f662e3..9b4fbfd0e5 100644 --- a/api/@ohos.util.Deque.d.ts +++ b/api/@ohos.util.Deque.d.ts @@ -101,14 +101,14 @@ declare class Deque { /** * Gets the element number of the Deque. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserts an element into the deque header. * @@ -430,7 +430,7 @@ declare class Deque { /** * Returns the byte at the specified index. * - * @param { number } index - The zero-based index of the desired code unit. + * @param { int } index - The zero-based index of the desired code unit. * @returns { T } The element in the deque matching the given index. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -438,12 +438,12 @@ declare class Deque { * @since 20 * @arkts 1.2 */ - $_get(index: number): T; + $_get(index: int): T; /** * Sets the byte at the specified index. * - * @param { number } index – The index of the element to set. + * @param { int } index – The index of the element to set. * @param { T } value – The value to set at the specified index. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -451,7 +451,7 @@ declare class Deque { * @since 20 * @arkts 1.2 */ - $_set(index: number, value: T): void; + $_set(index: int, value: T): void; /** * returns an iterator.Each item of the iterator is a Javascript Object @@ -495,19 +495,19 @@ declare class Deque { $_iterator(): IterableIterator; } - /** - * The type of Deque forEach callback function. - * - * @typedef { function } DequeForEachCb - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { Deque } deque - The Deque instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - export type DequeForEachCb = (value: T, index: number, deque: Deque) => void; +/** + * The type of Deque forEach callback function. + * + * @typedef { function } DequeForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { Deque } deque - The Deque instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type DequeForEachCb = (value: T, index: int, deque: Deque) => void; export default Deque; diff --git a/api/@ohos.util.HashMap.d.ts b/api/@ohos.util.HashMap.d.ts index d7d500dc18..ac14ee3aa6 100644 --- a/api/@ohos.util.HashMap.d.ts +++ b/api/@ohos.util.HashMap.d.ts @@ -98,14 +98,14 @@ declare class HashMap { /** * Gets the element number of the HashMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements * diff --git a/api/@ohos.util.HashSet.d.ts b/api/@ohos.util.HashSet.d.ts index 6607d94f10..cc171a9b40 100644 --- a/api/@ohos.util.HashSet.d.ts +++ b/api/@ohos.util.HashSet.d.ts @@ -95,14 +95,14 @@ declare class HashSet { /** * Gets the element number of the HashSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements * diff --git a/api/@ohos.util.LightWeightMap.d.ts b/api/@ohos.util.LightWeightMap.d.ts index 3433c11fcc..bf044729c6 100644 --- a/api/@ohos.util.LightWeightMap.d.ts +++ b/api/@ohos.util.LightWeightMap.d.ts @@ -95,14 +95,14 @@ declare class LightWeightMap { /** * Gets the element number of the LightWeightMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether this map has all the object in a specified map * @@ -237,7 +237,7 @@ declare class LightWeightMap { * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -248,7 +248,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order * @@ -346,7 +346,7 @@ declare class LightWeightMap { * Obtains the index of the key equal to a specified key in an LightWeightMap container * * @param { K } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -354,7 +354,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: K): number; + getIndexOfKey(key: K): int; /** * Obtains the index of the value equal to a specified value in an LightWeightMap container * @@ -378,7 +378,7 @@ declare class LightWeightMap { * Obtains the index of the value equal to a specified value in an LightWeightMap container * * @param { V } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -386,7 +386,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: V): number; + getIndexOfValue(value: V): int; /** * Returns whether the Map object contains elements * @@ -465,7 +465,7 @@ declare class LightWeightMap { /** * Obtains the key at the location identified by index in an LightWeightMap container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { K | undefined } the key of key-value pairs or undefined * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -474,7 +474,7 @@ declare class LightWeightMap { * @since 20 * @arkts 1.2 */ - getKeyAt(index: number): K | undefined; + getKeyAt(index: int): K | undefined; /** * Obtains a ES6 iterator that contains all the keys of an LightWeightMap container * @@ -650,7 +650,7 @@ declare class LightWeightMap { /** * Deletes a key-value pair at the location identified by index from an LightWeightMap container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -662,7 +662,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -726,7 +726,7 @@ declare class LightWeightMap { /** * Sets the value identified by index in an LightWeightMap container to a specified value * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { V } newValue - newValue value Updated the target mapped value * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. @@ -741,7 +741,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, newValue: V): boolean; + setValueAt(index: int, newValue: V): boolean; /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys. @@ -929,7 +929,7 @@ declare class LightWeightMap { /** * Obtains the value identified by index in an LightWeightMap container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { V | undefined } the value of key-value pairs or undefined * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -938,7 +938,7 @@ declare class LightWeightMap { * @since 20 * @arkts 1.2 */ - getValueAt(index: number): V | undefined; + getValueAt(index: int): V | undefined; /** * Returns an iterator of the values contained in this map * diff --git a/api/@ohos.util.LightWeightSet.d.ts b/api/@ohos.util.LightWeightSet.d.ts index cd20907d09..f3c655d6c9 100644 --- a/api/@ohos.util.LightWeightSet.d.ts +++ b/api/@ohos.util.LightWeightSet.d.ts @@ -96,14 +96,14 @@ declare class LightWeightSet { /** * Gets the element number of the LightWeightSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * If the set does not contain the element, the specified element is added @@ -305,7 +305,7 @@ declare class LightWeightSet { * Ensures that the capacity of an LightWeightSet container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -318,7 +318,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Obtains the index of s key of a specified Object type in an LightWeightSet container * @@ -342,7 +342,7 @@ declare class LightWeightSet { * Obtains the index of s key of a specified Object type in an LightWeightSet container * * @param { T } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -350,7 +350,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(key: T): number; + getIndexOf(key: T): int; /** * Deletes an object of a specified Object type from an LightWeightSet container * @@ -424,7 +424,7 @@ declare class LightWeightSet { /** * Deletes an object at the location identified by index from an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -436,7 +436,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -675,7 +675,7 @@ declare class LightWeightSet { /** * Obtains the object at the location identified by index in an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T | undefined } the value at the specified index, or undefined if the index out of range * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -683,7 +683,7 @@ declare class LightWeightSet { * @since 20 * @arkts 1.2 */ - getValueAt(index: number): T | undefined; + getValueAt(index: int): T | undefined; /** * Returns a ES6 iterator of the values contained in this Set diff --git a/api/@ohos.util.LinkedList.d.ts b/api/@ohos.util.LinkedList.d.ts index 33c16b088f..6aeef690a8 100644 --- a/api/@ohos.util.LinkedList.d.ts +++ b/api/@ohos.util.LinkedList.d.ts @@ -102,14 +102,14 @@ declare class LinkedList { /** * Gets the element number of the LinkedList. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this linkedlist. @@ -175,7 +175,7 @@ declare class LinkedList { /** * Inserts the specified element at the specified position in this linkedlist. * - * @param { number } index - index index index at which the specified element is to be inserted + * @param { int } index - index index index at which the specified element is to be inserted * @param { T } element - element element element to be inserted * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -189,7 +189,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(index: number, element: T): void; + insert(index: int, element: T): void; /** * Returns the element at the specified position in this linkedlist, * or returns undefined if this linkedlist is empty @@ -238,7 +238,7 @@ declare class LinkedList { * Returns the element at the specified position in this linkedList, * or returns undefined if this linkedList is empty * - * @param { number } index - specified position + * @param { int } 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 @@ -246,7 +246,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Inserts the specified element at the beginning of this LinkedList. @@ -425,7 +425,7 @@ declare class LinkedList { * in this linkedlist, or -1 if this linkedlist 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. + * @returns { int } the int 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 @@ -433,7 +433,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -487,7 +487,7 @@ declare class LinkedList { /** * Find the corresponding element according to the index. * - * @param { number } index - the index in the linkedList + * @param { int } index - the index in the linkedList * @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}. @@ -498,7 +498,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this linkedlist, @@ -652,7 +652,7 @@ declare class LinkedList { * or -1 if the linkedlist does not contain the element. * * @param { T } element - element element element to find - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -660,7 +660,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this linkedlist. * or returns undefined if linkedlist is empty @@ -804,7 +804,7 @@ declare class LinkedList { /** * Replaces the element at the specified position in this Vector with the specified element * - * @param { number } index - index index index to find + * @param { int } index - index index index to find * @param { T } element - element element replaced element * @returns { T | undefined } the T type ,returns undefined if linkedList is empty * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -817,7 +817,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, element: T): T | undefined; /** * Replaces each element of this linkedlist with the result of applying the operator to that element. @@ -1028,7 +1028,7 @@ declare class LinkedList { * * @typedef { function } LinkedListForEachCb * @param { T } value - The value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { LinkedList } linkedList - The LinkedList instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1036,6 +1036,6 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ -export type LinkedListForEachCb = (value: T, index: number, linkedList: LinkedList) => void +export type LinkedListForEachCb = (value: T, index: int, linkedList: LinkedList) => void export default LinkedList; diff --git a/api/@ohos.util.List.d.ts b/api/@ohos.util.List.d.ts index 47f59fa10d..80699062c5 100644 --- a/api/@ohos.util.List.d.ts +++ b/api/@ohos.util.List.d.ts @@ -99,14 +99,14 @@ declare class List { /** * Gets the element number of the List. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this list. @@ -173,7 +173,7 @@ declare class List { * 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 + * @param { int } 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: @@ -186,7 +186,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Returns the element at the specified position in this list, * or returns undefined if this list is empty @@ -235,7 +235,7 @@ declare class List { * Returns the element at the specified position in this list, * or returns undefined if this list is empty * - * @param { number } index - specified position + * @param { int } 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 @@ -243,7 +243,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Check if list contains the specified element @@ -303,7 +303,7 @@ declare class List { * 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. + * @returns { int } the int 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 @@ -311,7 +311,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -362,7 +362,7 @@ declare class List { /** * Find the corresponding element according to the index. * - * @param { number } index - the index in the linkedList + * @param { int } index - the index in the linkedList * @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}. @@ -373,7 +373,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this list, @@ -439,7 +439,7 @@ declare class List { * or -1 if the list does not contain the element. * * @param { T } element - element element element to find - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -447,7 +447,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this list. * or returns undefined if list is empty @@ -586,7 +586,7 @@ declare class List { /** * Replaces the element at the specified position in this List with the specified element * - * @param { number } index - index to find + * @param { int } index - index to find * @param { T } element - replaced element * @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}. @@ -597,7 +597,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, 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. @@ -744,10 +744,28 @@ declare class List { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ sort(comparator: (firstValue: T, secondValue: T) => number): void; + /** + * Sorts this list according to the order induced by the specified comparator + * + * @param { ComparatorFn } [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 + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + sort(comparator?: ComparatorFn): void; /** * Removes all of the elements from this list.The list will * be empty after this call returns.length becomes 0 @@ -809,8 +827,8 @@ declare class List { /** * 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 + * @param { int } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position + * @param { int } toIndex - toIndex toIndex the end of the index, excluding the value at that index * @returns { List } * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. @@ -823,7 +841,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getSubList(fromIndex: number, toIndex: number): List; + getSubList(fromIndex: int, toIndex: int): List; /** * Replaces each element of this list with the result of applying the operator to that element. * @@ -950,7 +968,7 @@ declare class List { /** * Returns the item at that index * - * @param { number } index - the zero-based index of the desired code unit. + * @param { int } 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 @@ -959,12 +977,12 @@ declare class List { * @since 20 * @arkts 1.2 */ - $_get(index: number): T | undefined; + $_get(index: int): T | undefined; /** * Set the value of item at that index. * - * @param { number } index – the index of the element to set. + * @param { int } index – the index of the element to set. * @param { T } value – the value to set at the specified index * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -972,7 +990,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - $_set(index: number, value: T): void; + $_set(index: int, value: T): void; /** * returns an iterator.Each item of the iterator is a Javascript Object * @@ -1015,13 +1033,26 @@ declare class List { $_iterator(): IterableIterator; } - +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ComparatorFn = (firstValue: T, secondValue: T) => double; /** * 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 { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1029,14 +1060,14 @@ declare class List { * @since 20 * @arkts 1.2 */ -export type ListForEachCb = (value: T, index: number, list: List) => void +export type ListForEachCb = (value: T, index: int, list: List) => 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 { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { T } - The new value of current element * @syscap SystemCapability.Utils.Lang @@ -1044,6 +1075,6 @@ export type ListForEachCb = (value: T, index: number, list: List) => void * @since 20 * @arkts 1.2 */ -export type ListReplaceCb = (value: T, index: number, list: List) => T +export type ListReplaceCb = (value: T, index: int, list: List) => T export default List; diff --git a/api/@ohos.util.PlainArray.d.ts b/api/@ohos.util.PlainArray.d.ts index d6c40f936a..a4a9138e41 100644 --- a/api/@ohos.util.PlainArray.d.ts +++ b/api/@ohos.util.PlainArray.d.ts @@ -99,14 +99,14 @@ declare class PlainArray { /** * Gets the element number of the PlainArray. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends a key-value pair to PlainArray @@ -136,7 +136,7 @@ declare class PlainArray { /** * Appends a key-value pair to PlainArray * - * @param { number } key - key key Added the key of key-value + * @param { int } key - key key Added the key of key-value * @param { T } value - value value Added the value of key-value * @throws { BusinessError } 10200011 - The add method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -148,7 +148,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - add(key: number, value: T): void; + add(key: int, value: T): void; /** * Clears the current PlainArray object * @@ -232,7 +232,7 @@ declare class PlainArray { /** * Checks whether the current PlainArray object contains the specified key * - * @param { number } key - key key need to determine whether to include the key + * @param { int } key - key key need to determine whether to include the key * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The has method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -244,7 +244,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - has(key: number): boolean; + has(key: int): boolean; /** * Queries the value associated with the specified key * @@ -289,7 +289,7 @@ declare class PlainArray { /** * Queries the value associated with the specified key * - * @param { number } key - looking for goals + * @param { int } key - looking for goals * @returns { T | undefined } the value of key-value pairs * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -298,7 +298,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - get(key: number): T | undefined; + get(key: int): T | undefined; /** * Queries the index for a specified key @@ -328,8 +328,8 @@ declare class PlainArray { /** * Queries the index for a specified key * - * @param { number } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @param { int } key - key key Looking for goals + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -340,7 +340,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: number): number; + getIndexOfKey(key: int): int; /** * Queries the index for a specified value * @@ -364,7 +364,7 @@ declare class PlainArray { * Queries the index for a specified value * * @param { T } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -372,7 +372,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: T): number; + getIndexOfValue(value: T): int; /** * Checks whether the current PlainArray object is empty * @@ -499,7 +499,7 @@ declare class PlainArray { /** * Remove the key-value pair based on a specified key if it exists and return the value * - * @param { number } key - target to be deleted + * @param { int } key - target to be deleted * @returns { T | undefined } target mapped value, or undefined if key is not exist * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -508,7 +508,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - remove(key: number): T | undefined; + remove(key: int): T | undefined; /** * Remove the key-value pair at a specified index if it exists and return the value @@ -554,7 +554,7 @@ declare class PlainArray { /** * Remove the key-value pair at a specified index if it exists and return the value * - * @param { number } index - target subscript for search + * @param { int } index - target subscript for search * @returns { T | undefined } the T type, or undefined if container is empty * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -563,7 +563,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - removeAt(index: number): T | undefined; + removeAt(index: int): T | undefined; /** * Remove a group of key-value pairs from a specified index @@ -597,9 +597,9 @@ declare class PlainArray { /** * Remove a group of key-value pairs from a specified index * - * @param { number } index - index index remove start index - * @param { number } size - size size Expected deletion quantity - * @returns { number } Actual deleted quantity + * @param { int } index - index index remove start index + * @param { int } size - size size Expected deletion quantity + * @returns { int } Actual deleted quantity * @throws { BusinessError } 10200011 - The removeRangeFrom method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -611,7 +611,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeRangeFrom(index: number, size: number): number; + removeRangeFrom(index: int, size: int): int; /** * Update value on specified index * @@ -642,7 +642,7 @@ declare class PlainArray { /** * Update value on specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { T } value - value value Updated the target mapped value * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -655,7 +655,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, value: T): void; + setValueAt(index: int, value: T): void; /** * Obtains the string representation of the PlainArray object * @@ -715,7 +715,7 @@ declare class PlainArray { /** * Queries the value at a specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T } the value of key-value pairs * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -728,7 +728,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getValueAt(index: number): T; + getValueAt(index: int): T; /** * Executes a provided function once for each value in the PlainArray object. * @@ -826,14 +826,14 @@ declare class PlainArray { /** * returns an iterator. Each item of the iterator is a ArkTS Object * - * @returns { IterableIterator<[number, T]> } + * @returns { IterableIterator<[double, T]> } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_iterator(): IterableIterator<[number, T]>; + $_iterator(): IterableIterator<[double, T]>; } @@ -842,7 +842,7 @@ declare class PlainArray { * * @typedef { function } PlainArrayForEachCb * @param { T } value - The value of current element - * @param { number } key - The key of current element + * @param { int } key - The key of current element * @param { PlainArray } PlainArray - The PlainArray instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -850,6 +850,6 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ -export type PlainArrayForEachCb = (value: T, key: number, PlainArray: PlainArray) => void +export type PlainArrayForEachCb = (value: T, key: int, PlainArray: PlainArray) => void export default PlainArray; diff --git a/api/@ohos.util.Queue.d.ts b/api/@ohos.util.Queue.d.ts index 90724be60b..94a1a476bc 100644 --- a/api/@ohos.util.Queue.d.ts +++ b/api/@ohos.util.Queue.d.ts @@ -102,14 +102,14 @@ declare class Queue { /** * Gets the element number of the Queue. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserting specified element at the end of a queue if it is possible to do @@ -341,7 +341,7 @@ declare class Queue { * * @typedef { function } QueueForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Queue } queue - The Queue instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -349,6 +349,6 @@ declare class Queue { * @since 20 * @arkts 1.2 */ -export type QueueForEachCb = (value: T, index: number, queue: Queue) => void +export type QueueForEachCb = (value: T, index: int, queue: Queue) => void export default Queue; diff --git a/api/@ohos.util.Stack.d.ts b/api/@ohos.util.Stack.d.ts index 1e76aa0578..527c732d4d 100644 --- a/api/@ohos.util.Stack.d.ts +++ b/api/@ohos.util.Stack.d.ts @@ -99,14 +99,14 @@ declare class Stack { /** * Gets the element number of the Stack. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Tests if this stack is empty @@ -282,7 +282,7 @@ declare class Stack { * Returns the 1-based position where an object is on this stack * * @param { T } element - element element Target to be deleted - * @returns { number } the T type,If there is no such element, return -1 + * @returns { int } the T type,If there is no such element, return -1 * @throws { BusinessError } 10200011 - The locate method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -290,7 +290,7 @@ declare class Stack { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - locate(element: T): number; + locate(element: T): int; /** * Executes a provided function once for each value in the Stack object. * @@ -404,7 +404,7 @@ declare class Stack { * * @typedef { function } StackForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Stack } stack - The Stack instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -412,6 +412,6 @@ declare class Stack { * @since 20 * @arkts 1.2 */ -export type StackForEachCb = (value: T, index: number, stack: Stack) => void +export type StackForEachCb = (value: T, index: int, stack: Stack) => void export default Stack; diff --git a/api/@ohos.util.TreeMap.d.ts b/api/@ohos.util.TreeMap.d.ts index abd92fe674..3108795a45 100644 --- a/api/@ohos.util.TreeMap.d.ts +++ b/api/@ohos.util.TreeMap.d.ts @@ -136,14 +136,14 @@ declare class TreeMap { /** * Gets the element number of the TreeMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements @@ -879,12 +879,12 @@ export type TreeMapForEachCb = (value: V, key: K, map: TreeMap) => v * @typedef { function } TreeMapComparator * @param { K } firstValue - The first value compared * @param { K } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -export type TreeMapComparator = (firstValue: K, secondValue: K) => number +export type TreeMapComparator = (firstValue: K, secondValue: K) => double export default TreeMap; diff --git a/api/@ohos.util.TreeSet.d.ts b/api/@ohos.util.TreeSet.d.ts index 234c1885de..3c44055c59 100644 --- a/api/@ohos.util.TreeSet.d.ts +++ b/api/@ohos.util.TreeSet.d.ts @@ -133,14 +133,14 @@ declare class TreeSet { /** * Gets the element number of the TreeSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements @@ -773,12 +773,12 @@ export type TreeSetForEachCb = (value: T, key: T, set: TreeSet) => void * @typedef { function } TreeSetComparator * @param { T } firstValue - The first value compared * @param { T } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -export type TreeSetComparator = (firstValue: T, secondValue: T) => number +export type TreeSetComparator = (firstValue: T, secondValue: T) => double export default TreeSet; -- Gitee