No-reuse-streams (original) (raw)

Henry Jen henry.jen at oracle.com
Mon Nov 26 08:45:45 PST 2012


On Nov 26, 2012, at 8:21 AM, "David M. Lloyd" <david.lloyd at redhat.com> wrote:

Should the following throw an ISE on the last line of the following?

Stream s = .. Object i1 = s.findFirst(); Stream s1 = s.map(...); i.e. should we fail on the s.map(...) or just when a terminal operation occurs, if at all? I agree with you and Rémi - this should fail.

While it may be "consistent", what is the obvious alternative when need to do something like this? A use case like this is probably following,

For a input stream, find a marker, and then continue to process the rest of stream.

I guess the general question is: how does one control the flow of the stream? How do we continue the stream after a terminal op which does not consume whole stream.

Cheers, Henry



More information about the lambda-libs-spec-observers mailing list