如何在 Stream 链中调用 setter
2022-09-03 12:48:39
如何在不使用 forEach() 的情况下调用 Stream 链中的 setter?
List<Foo> newFoos = foos.stream()
.filter(foo -> Foo::isBlue)
.map(foo -> foo.setTitle("Some value")) //I am unable to use this because also changing the data type into Object
.collect(Collectors.toList());