mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 13:00:22 +08:00
修改0349 - 用 Java stream 代替 for loop (这样主题更明显)
This commit is contained in:
@ -104,13 +104,8 @@ class Solution {
|
|||||||
resSet.add(i);
|
resSet.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int[] resArr = new int[resSet.size()];
|
|
||||||
int index = 0;
|
|
||||||
//将结果几何转为数组
|
//将结果几何转为数组
|
||||||
for (int i : resSet) {
|
return resSet.stream().mapToInt(x -> x).toArray();
|
||||||
resArr[index++] = i;
|
|
||||||
}
|
|
||||||
return resArr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user