我正在对一个整数数组运行“Stream”操作。
然后我创建了一个“Cell”对象进行一些操作并应用了过滤器,
我想创建一个从整数到“Cell”的映射,只包含有效的“Cell”。
大致如下:
List<Integer> type = new ArrayList<>();
Map<Integer, Cell> map =
list.stream()
.map(x -> new Cell(x+1, x+2)) // Some kind of Manipulations
.filter(cell->isNewCellValid(cell)) // filter some
.collect(Collectors.toMap(....));
在流操作期间是否可以使用原始流对象?