Can I duplicate a Stream in Java 8?

后端 未结 8 2163
别跟我提以往
别跟我提以往 2020-12-08 04:03

Sometimes I want to perform a set of operations on a stream, and then process the resulting stream two different ways with other operations.

Can I do this without ha

8条回答
  •  情深已故
    2020-12-08 04:31

    You can also move the stream generation into separate method/function that returns this stream and call it twice.

提交回复
热议问题