提交 5cba2991 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 ee0ce630
...@@ -264,6 +264,7 @@ arrayList.removeByRange(2, 6); ...@@ -264,6 +264,7 @@ arrayList.removeByRange(2, 6);
``` ```
### replaceAllElements ### replaceAllElements
replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList&lt;T&gt;) => T, replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList&lt;T&gt;) => T,
thisArg?: Object): void thisArg?: Object): void
...@@ -301,6 +302,7 @@ arrayList.replaceAllElements((value, index) => { ...@@ -301,6 +302,7 @@ arrayList.replaceAllElements((value, index) => {
``` ```
### forEach ### forEach
forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList&lt;T&gt;) => void, forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList&lt;T&gt;) => void,
thisArg?: Object): void thisArg?: Object): void
...@@ -335,6 +337,7 @@ arrayList.forEach((value, index) => { ...@@ -335,6 +337,7 @@ arrayList.forEach((value, index) => {
``` ```
### sort ### sort
sort(comparator?: (firstValue: T, secondValue: T) => number): void sort(comparator?: (firstValue: T, secondValue: T) => number): void
Sorts entries in this container. Sorts entries in this container.
...@@ -366,6 +369,7 @@ arrayList.sort(); ...@@ -366,6 +369,7 @@ arrayList.sort();
``` ```
### subArrayList ### subArrayList
subArrayList(fromIndex: number, toIndex: number): ArrayList&lt;T&gt; subArrayList(fromIndex: number, toIndex: number): ArrayList&lt;T&gt;
Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **ArrayList** instance. Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **ArrayList** instance.
...@@ -397,6 +401,7 @@ let result3 = arrayList.subArrayList(2, 6); ...@@ -397,6 +401,7 @@ let result3 = arrayList.subArrayList(2, 6);
``` ```
### clear ### clear
clear(): void clear(): void
Clears this container and sets its length to **0**. Clears this container and sets its length to **0**.
...@@ -413,6 +418,7 @@ arrayList.clear(); ...@@ -413,6 +418,7 @@ arrayList.clear();
``` ```
### clone ### clone
clone(): ArrayList&lt;T&gt; clone(): ArrayList&lt;T&gt;
Clones this container and returns a copy. The modification to the copy does not affect the original instance. Clones this container and returns a copy. The modification to the copy does not affect the original instance.
...@@ -436,6 +442,7 @@ let result = arrayList.clone(); ...@@ -436,6 +442,7 @@ let result = arrayList.clone();
``` ```
### getCapacity ### getCapacity
getCapacity(): number getCapacity(): number
Obtains the capacity of this container. Obtains the capacity of this container.
...@@ -458,6 +465,7 @@ let result = arrayList.getCapacity(); ...@@ -458,6 +465,7 @@ let result = arrayList.getCapacity();
``` ```
### convertToArray ### convertToArray
convertToArray(): Array&lt;T&gt; convertToArray(): Array&lt;T&gt;
Converts this container into an array. Converts this container into an array.
...@@ -480,6 +488,7 @@ let result = arrayList.convertToArray(); ...@@ -480,6 +488,7 @@ let result = arrayList.convertToArray();
``` ```
### isEmpty ### isEmpty
isEmpty(): boolean isEmpty(): boolean
Checks whether this container is empty (contains no entry). Checks whether this container is empty (contains no entry).
...@@ -502,6 +511,7 @@ let result = arrayList.isEmpty(); ...@@ -502,6 +511,7 @@ let result = arrayList.isEmpty();
``` ```
### increaseCapacityTo ### increaseCapacityTo
increaseCapacityTo(newCapacity: number): void increaseCapacityTo(newCapacity: number): void
Increases the capacity of this container. Increases the capacity of this container.
...@@ -525,6 +535,7 @@ arrayList.increaseCapacityTo(8); ...@@ -525,6 +535,7 @@ arrayList.increaseCapacityTo(8);
``` ```
### trimToCurrentLength ### trimToCurrentLength
trimToCurrentLength(): void trimToCurrentLength(): void
Trims the capacity of this container to its current length. Trims the capacity of this container to its current length.
......
...@@ -158,6 +158,7 @@ let result = deque.popLast(); ...@@ -158,6 +158,7 @@ let result = deque.popLast();
``` ```
### forEach ### forEach
forEach(callbackfn: (value: T, index?: number, deque?: Deque&lt;T&gt;) => void, forEach(callbackfn: (value: T, index?: number, deque?: Deque&lt;T&gt;) => void,
thisArg?: Object): void thisArg?: Object): void
...@@ -193,7 +194,7 @@ deque.forEach((value, index) => { ...@@ -193,7 +194,7 @@ deque.forEach((value, index) => {
### getFirst ### getFirst
getFirst(): T; getFirst(): T
Obtains the first entry of this container. Obtains the first entry of this container.
......
...@@ -198,7 +198,7 @@ Uses a callback to traverse the entries in this container and obtain their posit ...@@ -198,7 +198,7 @@ Uses a callback to traverse the entries in this container and obtain their posit
callbackfn callbackfn
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the entry that is currently traversed.| | value | T | No| Value of the entry that is currently traversed.|
| key | T | No| Key of the entry that is currently traversed (same as **value**).| | key | T | No| Key of the entry that is currently traversed (same as **value**).|
| set | HashSet&lt;T&gt; | No| Instance that invokes the **forEach** method.| | set | HashSet&lt;T&gt; | No| Instance that invokes the **forEach** method.|
......
...@@ -524,8 +524,8 @@ Uses a callback to traverse the entries in this container and obtain their posit ...@@ -524,8 +524,8 @@ Uses a callback to traverse the entries in this container and obtain their posit
callbackfn callbackfn
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | V | Yes| Value of the entry that is currently traversed.| | value | V | No| Value of the entry that is currently traversed.|
| key | K | Yes| Key of the entry that is currently traversed.| | key | K | No| Key of the entry that is currently traversed.|
| map | LightWeightMap<K, V> | No| Instance that invokes the **forEach** method.| | map | LightWeightMap<K, V> | No| Instance that invokes the **forEach** method.|
**Example** **Example**
......
...@@ -279,7 +279,7 @@ Removes the entry at the specified position from this container. ...@@ -279,7 +279,7 @@ Removes the entry at the specified position from this container.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| index | number | Yes| Position index of the entry to remove.| | index | number | Yes| Position index of the entry.|
**Return value** **Return value**
......
...@@ -117,6 +117,7 @@ let result = queue.getFirst(); ...@@ -117,6 +117,7 @@ let result = queue.getFirst();
``` ```
### forEach ### forEach
forEach(callbackfn: (value: T, index?: number, Queue?: Queue&lt;T&gt;) => void, forEach(callbackfn: (value: T, index?: number, Queue?: Queue&lt;T&gt;) => void,
thisArg?: Object): void thisArg?: Object): void
......
...@@ -145,6 +145,7 @@ let result = stack.locate(2); ...@@ -145,6 +145,7 @@ let result = stack.locate(2);
``` ```
### forEach ### forEach
forEach(callbackfn: (value: T, index?: number, stack?: Stack&lt;T&gt;) => void, forEach(callbackfn: (value: T, index?: number, stack?: Stack&lt;T&gt;) => void,
thisArg?: Object): void thisArg?: Object): void
...@@ -179,6 +180,7 @@ stack.forEach((value, index) => { ...@@ -179,6 +180,7 @@ stack.forEach((value, index) => {
``` ```
### isEmpty ### isEmpty
isEmpty(): boolean isEmpty(): boolean
Checks whether this container is empty (contains no entries). Checks whether this container is empty (contains no entries).
......
...@@ -241,7 +241,8 @@ let result = vector.remove(2); ...@@ -241,7 +241,8 @@ let result = vector.remove(2);
``` ```
### removeByRange ### removeByRange
removeByRange(fromIndex: number, toIndex: number): void;
removeByRange(fromIndex: number, toIndex: number): void
Removes from this container all of the entries within a range, including the entry at the start position but not that at the end position. Removes from this container all of the entries within a range, including the entry at the start position but not that at the end position.
...@@ -266,6 +267,7 @@ vector.removeByRange(2,6); ...@@ -266,6 +267,7 @@ vector.removeByRange(2,6);
``` ```
### replaceAllElements ### replaceAllElements
replaceAllElements(callbackfn: (value: T, index?: number, vector?: Vector&lt;T&gt;) => T, replaceAllElements(callbackfn: (value: T, index?: number, vector?: Vector&lt;T&gt;) => T,
thisArg?: Object): void thisArg?: Object): void
...@@ -303,8 +305,9 @@ vector.replaceAllElements((value, index) => { ...@@ -303,8 +305,9 @@ vector.replaceAllElements((value, index) => {
``` ```
### forEach ### forEach
forEach(callbackfn: (value: T, index?: number, vector?: Vector&lt;T&gt;) => void, forEach(callbackfn: (value: T, index?: number, vector?: Vector&lt;T&gt;) => void,
thisArg?: Object): void; thisArg?: Object): void
Uses a callback to traverse the entries in this container and obtain their position indexes. Uses a callback to traverse the entries in this container and obtain their position indexes.
...@@ -338,6 +341,7 @@ vector.forEach((value, index) => { ...@@ -338,6 +341,7 @@ vector.forEach((value, index) => {
``` ```
### sort ### sort
sort(comparator?: (firstValue: T, secondValue: T) => number): void sort(comparator?: (firstValue: T, secondValue: T) => number): void
Sorts entries in this container. Sorts entries in this container.
...@@ -369,6 +373,7 @@ vector.sort(); ...@@ -369,6 +373,7 @@ vector.sort();
``` ```
### subVector ### subVector
subVector(fromIndex: number, toIndex: number): Vector&lt;T&gt; subVector(fromIndex: number, toIndex: number): Vector&lt;T&gt;
Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **Vector** instance. Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **Vector** instance.
...@@ -401,6 +406,7 @@ let result2 = vector.subVector(2,6); ...@@ -401,6 +406,7 @@ let result2 = vector.subVector(2,6);
``` ```
### clear ### clear
clear(): void clear(): void
Clears all entries in this container and sets its length to **0**. Clears all entries in this container and sets its length to **0**.
...@@ -417,6 +423,7 @@ vector.clear(); ...@@ -417,6 +423,7 @@ vector.clear();
``` ```
### clone ### clone
clone(): Vector&lt;T&gt; clone(): Vector&lt;T&gt;
Clones this container and returns a copy. The modification to the copy does not affect the original instance. Clones this container and returns a copy. The modification to the copy does not affect the original instance.
...@@ -439,6 +446,7 @@ let result = vector.clone(); ...@@ -439,6 +446,7 @@ let result = vector.clone();
``` ```
### getCapacity ### getCapacity
getCapacity(): number getCapacity(): number
Obtains the capacity of this container. Obtains the capacity of this container.
...@@ -461,6 +469,7 @@ let result = vector.getCapacity(); ...@@ -461,6 +469,7 @@ let result = vector.getCapacity();
``` ```
### convertToArray ### convertToArray
convertToArray(): Array&lt;T&gt; convertToArray(): Array&lt;T&gt;
Converts this container into an array. Converts this container into an array.
...@@ -483,6 +492,7 @@ let result = vector.convertToArray(); ...@@ -483,6 +492,7 @@ let result = vector.convertToArray();
``` ```
### isEmpty ### isEmpty
isEmpty(): boolean isEmpty(): boolean
Checks whether this container is empty (contains no entries). Checks whether this container is empty (contains no entries).
...@@ -505,6 +515,7 @@ let result = vector.isEmpty(); ...@@ -505,6 +515,7 @@ let result = vector.isEmpty();
``` ```
### increaseCapacityTo ### increaseCapacityTo
increaseCapacityTo(newCapacity: number): void increaseCapacityTo(newCapacity: number): void
Increases the capacity of this container. Increases the capacity of this container.
...@@ -700,6 +711,7 @@ let result = vector.getIndexFrom(4, 3); ...@@ -700,6 +711,7 @@ let result = vector.getIndexFrom(4, 3);
``` ```
### setLength ### setLength
setLength(newSize: number): void setLength(newSize: number): void
Sets a new length for this container. Sets a new length for this container.
...@@ -723,6 +735,7 @@ vector.setLength(2); ...@@ -723,6 +735,7 @@ vector.setLength(2);
``` ```
### get ### get
get(index: number): T get(index: number): T
Obtains an entry at the specified position in this container. Obtains an entry at the specified position in this container.
...@@ -750,6 +763,7 @@ Obtains an entry at the specified position in this container. ...@@ -750,6 +763,7 @@ Obtains an entry at the specified position in this container.
let result = vector.get(2); let result = vector.get(2);
``` ```
### set ### set
set(index: number, element: T): T set(index: number, element: T): T
Replaces an entry at the specified position in this container with a given entry. Replaces an entry at the specified position in this container with a given entry.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册