未验证 提交 4c744d18 编写于 作者: O openharmony_ci 提交者: Gitee

!23626 docs arkts整改

Merge pull request !23626 from coollixin/master
......@@ -456,7 +456,7 @@ arrayList.add(2);
arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.forEach((value: number, index: number) => {
arrayList.forEach((value: number, index?: number) => {
console.log("hyq value:" + value, "index:" + index);
});
```
......
......@@ -634,9 +634,9 @@ import buffer from '@ohos.buffer';
let buf = buffer.from('buffer');
let pair = buf.entries()
let next = pair.next()
let next: IteratorResult<Object[]> = pair.next()
while (!next.done) {
console.info(next.value)
console.info("buffer: " + next.value)
next = pair.next()
}
```
......@@ -1963,7 +1963,7 @@ import buffer from '@ohos.buffer';
let buf1 = buffer.from('buffer');
let pair = buf1.values()
let next = pair.next()
let next:IteratorResult<number> = pair.next()
while (!next.done) {
console.log(next.value.toString());
next = pair.next()
......@@ -2923,8 +2923,8 @@ import buffer from '@ohos.buffer';
let blob: buffer.Blob = new buffer.Blob(['a', 'b', 'c']);
class option {
endings: string
type: string
endings: string = ""
type: string = ""
}
let o1: option = {endings:'native', type: 'MIME'}
let blob1: buffer.Blob = new buffer.Blob(['a', 'b', 'c'], o1);
......
......@@ -119,8 +119,8 @@ insertEnd(element: T): void
```ts
class C1 {
name: string
age: string
name: string = ""
age: string = ""
}
let deque: Deque<string | number | boolean | Array<number> | C1> = new Deque();
......@@ -277,7 +277,7 @@ deque.insertFront(2);
deque.insertEnd(4);
deque.insertFront(5);
deque.insertEnd(4);
deque.forEach((value: number, index: number) => {
deque.forEach((value: number, index?: number | undefined, deque?: Deque<number> | undefined):void => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -386,9 +386,9 @@ for (let item of nums) {
// 使用方法二:
let iter = deque[Symbol.iterator]();
let temp = iter.next().value;
while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
let temp:IteratorResult<number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
}
```
\ No newline at end of file
......@@ -363,7 +363,7 @@ let hashMap: HashMap<string, number> = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let iter = hashMap.keys();
let temp = iter.next();
let temp: IteratorResult<string,number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......@@ -400,7 +400,7 @@ let hashMap: HashMap<string, number> = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let iter = hashMap.values();
let temp = iter.next();
let temp: IteratorResult<number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......@@ -482,7 +482,7 @@ callbackfn的参数说明:
let hashMap: HashMap<string, number> = new HashMap();
hashMap.set("sparrow", 123);
hashMap.set("gull", 357);
hashMap.forEach((value: number, key: string) => {
hashMap.forEach((value?: number, key?: string) => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -517,7 +517,7 @@ let hashMap: HashMap<string, number> = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let iter = hashMap.entries();
let temp = iter.next();
let temp: IteratorResult<Object[]> = iter.next();
while(!temp.done) {
console.log("key:" + temp.value[0]);
console.log("value:" + temp.value[1]);
......@@ -555,14 +555,14 @@ hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
// 使用方法一:
for (let item of hashMap) {
console.log("key:" + item[0]);
console.log("value:" + item[1]);
for (let key of keys) {
console.log("key:" + key);
console.log("value:" + hashMap.get(key));
}
// 使用方法二:
let iter = hashMap[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<Object[]> = iter.next().value;
while(temp != undefined) {
console.log("key:" + temp[0]);
console.log("value:" + temp[1]);
......
......@@ -305,7 +305,7 @@ callbackfn的参数说明:
let hashSet: HashSet<string> = new HashSet();
hashSet.add("sparrow");
hashSet.add("squirrel");
hashSet.forEach((value: string, key: string) => {
hashSet.forEach((value?: string, key?: string): void => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -339,7 +339,7 @@ let hashSet: HashSet<string> = new HashSet();
hashSet.add("squirrel");
hashSet.add("sparrow");
let iter = hashSet.entries();
let temp = iter.next();
let temp: IteratorResult<string> = iter.next();
while(!temp.done) {
console.log("key:" + temp.value[0]);
console.log("value:" + temp.value[1]);
......@@ -385,7 +385,7 @@ for (let item of val) {
// 使用方法二:
let iter = hashSet[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<string> = iter.next();
while(!temp.done) {
console.log("value: " + temp.value);
temp = iter.next();
......
......@@ -666,7 +666,7 @@ let lightWeightMap: LightWeightMap<string, number> = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.keys();
let temp = iter.next();
let temp: IteratorResult<string, number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......@@ -703,7 +703,7 @@ let lightWeightMap: LightWeightMap<string, number> = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.values();
let temp = iter.next();
let temp: IteratorResult<number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......@@ -747,7 +747,7 @@ callbackfn的参数说明:
let lightWeightMap: LightWeightMap<string, number> = new LightWeightMap();
lightWeightMap.set("sparrow", 123);
lightWeightMap.set("gull", 357);
lightWeightMap.forEach((value: number, key: string) => {
lightWeightMap.forEach((value?: number, key?: string) => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -782,7 +782,7 @@ let lightWeightMap: LightWeightMap<string, number> = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.entries();
let temp = iter.next();
let temp: IteratorResult<Object[]> = iter.next();
while(!temp.done) {
console.log("key:" + temp.value[0]);
console.log("value:" + temp.value[1]);
......@@ -863,7 +863,7 @@ for (let item2 of key) {
// 使用方法二:
let iter = lightWeightMap[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<Object[]> = iter.next();
while(!temp.done) {
console.log("key:" + temp.value[0]);
console.log("value:" + temp.value[1]);
......
......@@ -611,7 +611,7 @@ callbackfn的参数说明:
let lightWeightSet: LightWeightSet<string> = new LightWeightSet();
lightWeightSet.add("sparrow");
lightWeightSet.add("gull");
lightWeightSet.forEach((value:string, key:string) => {
lightWeightSet.forEach((value ?: string, key ?: string) => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -691,7 +691,7 @@ for (let item of nums) {
// 使用方法二:
let iter = lightWeightSet[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<string> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......
......@@ -641,7 +641,7 @@ linkedList.add(2);
linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
linkedList.forEach((value:number, index: number) => {
linkedList.forEach((value: number, index?: number) => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -851,7 +851,7 @@ for (let item of items) {
// 使用方法二:
let iter = linkedList[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<number> = iter.next();
while(!temp.done) {
console.log("value:" + temp.value);
temp = iter.next();
......
......@@ -503,7 +503,7 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
list.forEach((value:number, index:number) => {
list.forEach((value: number, index?: number) => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -829,7 +829,7 @@ for (let item of items) {
// 使用方法二:
let iter = list[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<number> = iter.next();
while(!temp.done) {
console.log("value: " + temp.value);
temp = iter.next();
......
......@@ -620,7 +620,7 @@ callbackfn的参数说明:
let plainArray: PlainArray<string> = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
plainArray.forEach((value:string, index: number) => {
plainArray.forEach((value: string, index?: number) => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -656,7 +656,7 @@ plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let iter = plainArray[Symbol.iterator]();
let temp = iter.next();
let temp: IteratorResult<Object[]> = iter.next();
while(!temp.done) {
console.log("key:" + temp.value[0]);
console.log("value:" + temp.value[1]);
......
......@@ -206,7 +206,7 @@ queue.add(2);
queue.add(4);
queue.add(5);
queue.add(4);
queue.forEach((value : number, index : number) : void => {
queue.forEach((value : number, index ?: number) : void => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -249,7 +249,7 @@ while(queue.length) {
// 使用方法二:
let iter = queue[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<number> = iter.next().value;
while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
......
......@@ -244,7 +244,7 @@ stack.push(2);
stack.push(4);
stack.push(5);
stack.push(4);
stack.forEach((value : number, index : number) :void => {
stack.forEach((value : number, index ?: number) :void => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -321,7 +321,7 @@ while(!stack.isEmpty()) {
// 使用方法二:
let iter = stack[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<number> = iter.next().value;
while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
......
......@@ -302,7 +302,7 @@ treeMap.set("sparrow", 356);
let map : TreeMap<string, number> = new TreeMap();
map.set("demo", 12);
map.setAll(treeMap); // 将treeMap中的所有元素添加到map中
map.forEach((value : number, key : string) : void => {
map.forEach((value ?: number, key ?: string) : void => {
console.log("value" + value, "key" + key); // 打印结果 12 demo、356 sparrow、123 squirrel
})
```
......@@ -553,9 +553,9 @@ let treeMap : TreeMap<string, number> = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let it = treeMap.values();
let t = it.next();
let t: IteratorResult<number> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeMap" + t.value);
t = it.next()
}
```
......@@ -590,9 +590,9 @@ let treeMap : TreeMap<string, number> = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let it = treeMap.values();
let t = it.next();
let t: IteratorResult<number> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeMap" + t.value);
t = it.next()
}
```
......@@ -634,7 +634,7 @@ callbackFn的参数说明:
let treeMap : TreeMap<string, number> = new TreeMap();
treeMap.set("sparrow", 123);
treeMap.set("gull", 357);
treeMap.forEach((value : number, key : string) : void => {
treeMap.forEach((value ?: number, key ?: string) : void => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -669,9 +669,9 @@ let treeMap : TreeMap<string, number> = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let it = treeMap.entries();
let t = it.next();
let t: IteratorResult<Object[]> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeMap" + t.value);
t = it.next()
}
```
......@@ -707,14 +707,14 @@ treeMap.set("sparrow", 356);
// 使用方法一:
let it = treeMap.entries();
let t = it.next();
let t: IteratorResult<Object[]> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeMap" + t.value);
t = it.next()
// 使用方法二:
let iter = treeMap[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<Object[]> = iter.next().value;
while(temp != undefined) {
console.log("key:" + temp[0]);
console.log("value:" + temp[1]);
......
......@@ -462,9 +462,9 @@ let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let it = treeSet.values();
let t = it.next();
let t: IteratorResult<string> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeSet: " + t.value);
t = it.next()
}
```
......@@ -506,7 +506,7 @@ callbackFn的参数说明:
let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("sparrow");
treeSet.add("gull");
treeSet.forEach((value : string, key : string) :void => {
treeSet.forEach((value ?: string, key ?: string) :void => {
console.log("value:" + value, "key:" + key);
});
```
......@@ -541,9 +541,9 @@ let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let it = treeSet.entries();
let t = it.next();
let t: IteratorResult<Object[]> = it.next();
while(!t.done) {
console.log(t.value);
console.log("TreeSet: " + t.value);
t = it.next()
}
```
......@@ -585,7 +585,7 @@ for (let item of numbers) {
}
// 使用方法二:
let iter = treeSet[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<string> = iter.next().value;
while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
......
......@@ -44,7 +44,7 @@ Vector的构造函数。
**示例:**
```ts
let vector : Vector<string | number | C1 | Array<number>> = new Vector();
let vector : Vector<string | number | Array<number>> = new Vector();
```
......@@ -359,12 +359,12 @@ callbackfn的参数说明:
**示例:**
```ts
let vector : Vector<string | number | Object | Array<number>> = new Vector();
let vector : Vector<number> = new Vector();
vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
vector.forEach((value : Vector<string | number | Object | Array<number>> , index : number) : void => {
vector.forEach((value : number, index ?: number) : void => {
console.log("value:" + value, "index:" + index);
});
```
......@@ -864,7 +864,7 @@ for (let item of nums) {
// 使用方法二:
let iter = vector[Symbol.iterator]();
let temp = iter.next().value;
let temp: IteratorResult<number> = iter.next().value;
while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册