Java 流映射和收集 - 生成的容器的顺序
2022-08-31 16:12:29
List<MyObject> myList = new ArrayList<>();
//populate myList here
List<String> nameList = myList.stream()
.map(MyObject::getName)
.collect(Collectors.toList());
在上面的代码中,我可以期望名称的顺序总是与?MyObject
nameList
myList