Stream, spliterator, supplier and size (original) (raw)

Remi Forax forax at univ-mlv.fr
Fri Dec 14 06:39:31 PST 2012


Brian explains why there is methods in Streams that takes a Supplier and the flags in a previous mail (I'm too lazy to find it now). Stream stream(Supplier<Spliterator> supplier, int flags)

I've trouble to understand why we need to expose two semantics to our poor users, I think it's better to decide whenever (1) the spliterator is created when collection.stream() is called or (2) the spliterator is created when a terminal operation like stream.forEach is called.

It has severe implications on the way the pipeline works under the hood because the pipeline ops may relies on the size of the collection which may be different if the collection is mutated between the creation of the stream and the call to the terminal operation.

cheers, Rémi



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