How can I call the setter in chain of Stream without using forEach()?
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());
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…