Streams -- philosophy

Brian Goetz brian.goetz at oracle.com
Mon Dec 31 09:09:34 PST 2012


> On that, I think Stream should not have the method iterator() and
> splitterator() public,
> but Streams should have two static methods to expose an Iterator and a
> Spliterator.
> just to not shut down the idea to find a better abstraction between the
> release of 9.

I presume you mean something like:

class Streams {
     public static<T> Iterator<T> iterator(Stream<T>)
     public static<T> Spliterator<T> spliterator(Stream<T>)

But, static methods would have to work in terms of the public methods on 
Stream, so that they could work on any stream, not just our own. 
Meaning there must be some public way to get at the underlying data in 
the Stream interface.  So I think it boils down to the same thing?



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