On Tue, 31 Oct 2023 13:17:51 GMT, Viktor Klang <vkl...@openjdk.org> wrote:
>> This is a Draft PR for [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/AbstractPipeline.java line 223: > >> 221: previousStage.linkedOrConsumed = true; >> 222: >> 223: previousPreviousStage.nextStage = this; > > This allows subclasses to replace the "end" of a pipeline with a new "end" > presuming that the previous "end" is not linked nor consumed. As an example, > it allows a GathererOp(gathererA) to be replaced with a > GathererOp(gathererA.andThen(gathererB)) The constraint of "not linked or consumed" should be stated in the spec here, and probably documented with an `@throws` tag. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1378966890