23

Early jdk8-ea javadocs like this indicate there was a java.util.stream.Streamable interface, which would appear to have the same relationship to a Stream as Iterable has to an Iterator.

Now it seems like we're stuck with Supplier<Stream>, which is certainly not the same.

What happened to Streamable ?

Stuart Marks
  • 120,620
  • 35
  • 192
  • 252
krosenvold
  • 73,421
  • 30
  • 146
  • 205

1 Answers1

18

It's been removed some time ago. The rationale for the removal was given by Brian Goetz:

Currently the only implementor is Collection, and all of the other stream-bearing methods are serving up specialized streams (chars(), codePoints(), lines(), etc) with a method name that is more suitable than "stream". So I think we should drop Streamable and leave the stream() / parallel() methods on Collection (or possibly move them up Iterable).

And also:

I'm starting to think that Streamable is not carrying its weight. I'd like to consider dropping Streamable, at which point the base-most implementation of parallel() is in Collection, and I'd also suggest we consider renaming that to parallelStream().

In this other post he adds:

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?

assylias
  • 310,138
  • 72
  • 642
  • 762