Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3cc69662
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3cc69662
编写于
5月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4263 【OpenHarmony开源贡献者计划2022】Linear Container Vector API相关格式及表达问题
Merge pull request !4263 from king_he/0523-c
上级
80db5b26
1e05ec2e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
137 addition
and
137 deletion
+137
-137
en/application-dev/reference/apis/js-apis-vector.md
en/application-dev/reference/apis/js-apis-vector.md
+137
-137
未找到文件。
en/application-dev/reference/apis/js-apis-vector.md
浏览文件 @
3cc69662
# Linear Container Vector
>
![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/
>
>
**NOTE**<br
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -20,9 +20,9 @@ SystemCapability.Utils.Lang
### Attributes
| Name| Type| Readable| Writable| Description
|
| -------- | -------- | -------- | -------- | -------- |
| length | number | Yes| No| Number of entries in a vector (called container later).
|
| Name | Type | Readable | Writable | Description
|
| -------- | -------- | -------- | -------- | -------- |
| length | number | Yes | No | Number of entries in a vector (called container later).
|
### constructor
...
...
@@ -46,15 +46,15 @@ Adds an entry at the end of this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to add.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to add.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is added successfully; returns
**false**
otherwise.
|
| Type | Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is added successfully; returns
**false**
otherwise.
|
**Example**
...
...
@@ -76,10 +76,10 @@ Inserts an entry at the specified position in this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to insert.
|
| index | number | Yes| Index of the position where the entry is to be inserted.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to insert.
|
| index | number | Yes | Index of the position where the entry is to be inserted.
|
**Example**
...
...
@@ -98,15 +98,15 @@ Checks whether this container has the specified entry.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to check.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to check.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is contained; returns
**false**
otherwise.
|
| Type | Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is contained; returns
**false**
otherwise.
|
**Example**
...
...
@@ -125,15 +125,15 @@ Obtains the index of the first occurrence of the specified entry in this contain
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to obtain.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to obtain.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the specified entry is not found.
|
| Type | Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the specified entry is not found.
|
**Example**
...
...
@@ -157,15 +157,15 @@ Obtains the index of the last occurrence of the specified entry in this containe
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to obtain.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to obtain.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the specified entry is not found.
|
| Type | Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the specified entry is not found.
|
**Example**
...
...
@@ -189,15 +189,15 @@ Removes an entry at the specified position from this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| index | number | Yes| Position index of the entry to remove.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| index | number | Yes | Position index of the entry to remove.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| T | Entry removed.
|
| Type | Description
|
| -------- | -------- |
| T | Entry removed.
|
**Example**
...
...
@@ -219,15 +219,15 @@ Removes the first occurrence of the specified entry from this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to remove.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to remove.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is removed successfully; returns
**false**
otherwise.
|
| Type | Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the entry is removed successfully; returns
**false**
otherwise.
|
**Return value**
...
...
@@ -248,10 +248,10 @@ Removes from this container all of the entries within a range, including the ent
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| fromIndex | number | Yes| Index of the start position.
|
| toIndex | number | Yes| Index of the end position.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| fromIndex | number | Yes | Index of the start position.
|
| toIndex | number | Yes | Index of the end position.
|
**Example**
...
...
@@ -275,18 +275,18 @@ Replaces all entries in this container with new entries, and returns the new one
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| callbackfn | function | Yes| Callback invoked for replacement.
|
| thisArg | Object | No| Value to use when the callback is invoked.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| callbackfn | function | Yes | Callback invoked for replacement.
|
| thisArg | Object | No | Value to use when the callback is invoked.
|
callbackfn
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.
|
| index | number | No| Position index of the entry that is currently traversed.
|
| vector | Vector
<
T
>
| No| Instance that invokes the
**replaceAllElements**
API.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| value | T | Yes | Value of the entry that is currently traversed.
|
| index | number | No | Position index of the entry that is currently traversed.
|
| vector | Vector
<
T
>
| No | Instance that invokes the
**replaceAllElements**
API.
|
**Example**
...
...
@@ -313,18 +313,18 @@ Uses a callback to traverse the entries in this container and obtain their posit
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| callbackfn | function | Yes| Callback invoked for replacement.
|
| thisArg | Object | No| Value to use when the callback is invoked.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| callbackfn | function | Yes | Callback invoked for replacement.
|
| thisArg | Object | No | Value to use when the callback is invoked.
|
callbackfn
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.
|
| index | number | No| Position index of the entry that is currently traversed.
|
| vector | Vector
<
T
>
| No| Instance that invokes the
**forEach**
API.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| value | T | Yes | Value of the entry that is currently traversed.
|
| index | number | No | Position index of the entry that is currently traversed.
|
| vector | Vector
<
T
>
| No | Instance that invokes the
**forEach**
API.
|
**Example**
...
...
@@ -348,16 +348,16 @@ Sorts entries in this container.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| comparator | function | No | Callback invoked for sorting. |
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| comparator | function | No | Callback invoked for sorting. |
comparator
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| firstValue | T | Yes | Previous entry. |
| secondValue | T | Yes | Next entry. |
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| firstValue | T | Yes | Previous entry. |
| secondValue | T | Yes | Next entry. |
**Example**
...
...
@@ -380,16 +380,16 @@ Obtains entries within a range in this container, including the entry at the sta
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| fromIndex | number | Yes| Index of the start position.
|
| toIndex | number | Yes| Index of the end position.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| fromIndex | number | Yes | Index of the start position.
|
| toIndex | number | Yes | Index of the end position.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| Vector
<
T
>
| New
**Vector**
instance obtained.
|
| Type | Description
|
| -------- | -------- |
| Vector
<
T
>
| New
**Vector**
instance obtained.
|
**Return value**
...
...
@@ -430,9 +430,9 @@ Clones this container and returns a copy. The modification to the copy does not
**Return value**
| Type| Description
|
| -------- | -------- |
| Vector
<
T
>
| New
**Vector**
instance obtained.
|
| Type | Description
|
| -------- | -------- |
| Vector
<
T
>
| New
**Vector**
instance obtained.
|
**Example**
...
...
@@ -453,9 +453,9 @@ Obtains the capacity of this container.
**Return value**
| Type| Description
|
| -------- | -------- |
| number | Capacity obtained.
|
| Type | Description
|
| -------- | -------- |
| number | Capacity obtained.
|
**Example**
...
...
@@ -476,9 +476,9 @@ Converts this container into an array.
**Return value**
| Type| Description
|
| -------- | -------- |
| Array
<
T
>
| Array obtained.
|
| Type | Description
|
| -------- | -------- |
| Array
<
T
>
| Array obtained.
|
**Example**
...
...
@@ -499,9 +499,9 @@ Checks whether this container is empty (contains no entries).
**Return value**
| Type| Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the container is empty; returns
**false**
otherwise.
|
| Type | Description
|
| -------- | -------- |
| boolean | Returns
**true**
if the container is empty; returns
**false**
otherwise.
|
**Example**
...
...
@@ -522,9 +522,9 @@ Increases the capacity of this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| newCapacity | number | Yes| New capacity.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| newCapacity | number | Yes | New capacity.
|
**Example**
...
...
@@ -563,9 +563,9 @@ Uses commas (,) to concatenate entries in this container into a string.
**Return value**
| Type| Description
|
| -------- | -------- |
| string | String obtained.
|
| Type | Description
|
| -------- | -------- |
| string | String obtained.
|
**Example**
...
...
@@ -586,9 +586,9 @@ Copies entries in this container into an array to overwrite elements of the same
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| array | Array
<
T
>
| Yes| Array to which the entries in the container will be copied.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| array | Array
<
T
>
| Yes | Array to which the entries in the container will be copied.
|
**Example**
...
...
@@ -610,9 +610,9 @@ Obtains the first entry in this container.
**Return value**
| Type| Description
|
| -------- | -------- |
| T | The first entry obtained.
|
| Type | Description
|
| -------- | -------- |
| T | The first entry obtained.
|
**Example**
...
...
@@ -633,9 +633,9 @@ Obtains the last entry in this container.
**Return value**
| Type| Description
|
| -------- | -------- |
| T | The last entry obtained.
|
| Type | Description
|
| -------- | -------- |
| T | The last entry obtained.
|
**Example**
...
...
@@ -656,16 +656,16 @@ Searches for an entry backward from the specified position index and returns the
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to query.
|
| index | number | Yes| Position index where the search starts.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to query.
|
| index | number | Yes | Position index where the search starts.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the entry is not found.
|
| Type | Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the entry is not found.
|
**Example**
...
...
@@ -687,16 +687,16 @@ Searches for an entry forward from the specified position index and returns the
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes| Entry to query.
|
| index | number | Yes| Position index where the search starts.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| element | T | Yes | Entry to query.
|
| index | number | Yes | Position index where the search starts.
|
**Return value**
| Type| Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the entry is not found.
|
| Type | Description
|
| -------- | -------- |
| number | Returns the position index if obtained; returns
**-1**
if the entry is not found.
|
**Example**
...
...
@@ -718,9 +718,9 @@ Sets a new length for this container.
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| newSize | number | Yes| New length to set.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| newSize | number | Yes | New length to set.
|
**Example**
...
...
@@ -742,15 +742,15 @@ Obtains an entry at the specified position in this container.
**Parameters**
| Name
| Type| Mandatory| Description
|
| Name
| Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| index | number | Yes
| Position index of the entry to obtain.
|
| index | number | Yes
| Position index of the entry to obtain.
|
**Return value**
| Type
| Description
|
| Type
| Description
|
| -------- | -------- |
| T | Entry obtained.|
| T | Entry obtained.
|
**Example**
...
...
@@ -770,16 +770,16 @@ Replaces an entry at the specified position in this container with a given entry
**Parameters**
| Name| Type| Mandatory| Description
|
| -------- | -------- | -------- | -------- |
| index | number | Yes| Position index of the entry to replace.
|
| element | T | Yes| Entry to be used for replacement.
|
| Name | Type | Mandatory | Description
|
| -------- | -------- | -------- | -------- |
| index | number | Yes | Position index of the entry to replace.
|
| element | T | Yes | Entry to be used for replacement.
|
**Return value**
| Type
| Description
|
| Type
| Description
|
| -------- | -------- |
| T | New entry.|
| T | New entry.
|
**Example**
...
...
@@ -800,9 +800,9 @@ Replaces an entry at the specified position in this container with a given entry
Obtains an iterator. Each item of the iterator is a JavaScript object.
**Return value**
| Type| Description
|
| -------- | -------- |
| IterableIterator
<
T
>
| Iterator obtained.
|
| Type | Description
|
| -------- | -------- |
| IterableIterator
<
T
>
| Iterator obtained.
|
**Example**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录