parallelStream() methods (original) (raw)

Brian Goetz brian.goetz at oracle.com
Fri Feb 8 15:32:08 PST 2013


Here's the other issue this raises.

To my knowledge there's no Streamable interface defined.

Right. Earlier drafts had one (ask Doug to recount the "OMG so many interfaces" horror of Iteration 2), and since then we've been working really hard to eliminate each incremental public type, as each adds API surface area. I think we've been really successful at this; I'd hate to slide backwards.

Maybe it wasn't needed; I'm not sure. But once Iterable looks like this, now Iterable becomes the new Streamable. If you support a stream(), you'll implement Iterable to expose that fact. This is a little bit weird. I'm undecided on how big a problem it would be, but overall, Streamable seems like a pretty normal thing to have.

Leading question: if everything that is Iterable is effectively Streamable (because Iterable has a stream()) method, and everything Streamable is effectively Iterable (because you can turn a Spliterator into an Iterator), aren't they then the same abstraction?



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