提交 44c005ae 编写于 作者: W wangyong

Add TS constraint to the example of docs file

Description:
    1.Add TS constraint to the example of docs file
    2.correct some errors function in the docs example
    #I5DZD6:Add TS constraint to the example of docs file
Signed-off-by: Nwangyong <wangyong237@huawei.com>
上级 47fcc965
......@@ -319,10 +319,10 @@ arrayList.add(2);
arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.replaceAllElements((value, index) => {
arrayList.replaceAllElements((value: number, index: number)=> {
return value = 2 * value;
});
arrayList.replaceAllElements((value, index) => {
arrayList.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -393,8 +393,8 @@ arrayList.add(2);
arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.sort((a, b) => a - b);
arrayList.sort((a, b) => b - a);
arrayList.sort((a: number, b: number) => a - b);
arrayList.sort((a: number, b: number) => b - a);
arrayList.sort();
```
......
......@@ -363,10 +363,10 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
list.replaceAllElements((value, index) => {
list.replaceAllElements((value: number, index: number) => {
return value = 2 * value;
});
list.replaceAllElements((value, index) => {
list.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -438,8 +438,8 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
list.sort((a, b) => a - b);
list.sort((a, b) => b - a);
list.sort((a: number, b: number) => a - b);
list.sort((a: number, b: number) => b - a);
```
### getSubList
......@@ -471,9 +471,9 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
let result = list.subList(2, 4);
let result1 = list.subList(4, 3);
let result2 = list.subList(2, 6);
let result = list.getSubList(2, 4);
let result1 = list.getSubList(4, 3);
let result2 = list.getSubList(2, 6);
```
### clear
......
......@@ -318,10 +318,10 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
vector.replaceAllElements((value, index) => {
vector.replaceAllElements((value: number, index: number) => {
return value = 2 * value;
});
vector.replaceAllElements((value, index) => {
vector.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -393,8 +393,8 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
vector.sort((a, b) => a - b);
vector.sort((a, b) => b - a);
vector.sort((a: number, b: number) => a - b);
vector.sort((a: number, b: number) => b - a);
vector.sort();
```
......@@ -619,7 +619,7 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
let result = vector.toSting();
let result = vector.toString();
```
### copyToArray
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册