47. 优先使用 Collection 而不是 Stream 来作为方法的返回类型

This commit is contained in:
sjsdfg 2019-01-05 15:59:44 +08:00
parent 7848d43ed5
commit 8341a59b04

View File

@ -22,7 +22,7 @@ for (ProcessHandle ph : ProcessHandle.allProcesses()::iterator) {
  为了使代码编译,必须将方法引用强制转换为适当参数化的 `Iterable` 类型:
```Java`此处输入代码`
```Java
// Hideous workaround to iterate over a stream
for (ProcessHandle ph : (Iterable<ProcessHandle>)ProcessHandle.allProcesses()::iterator)
```