早jdk8-ea
javadocs like this表示有一个 java.util.stream.Streamable
接口(interface),这似乎与 Stream
具有相同的关系作为Iterable
有一个Iterator
.
现在我们似乎陷入了 Supplier<Stream>
的困境,这当然不一样。
Streamable
发生了什么?
最佳答案
它已经被删除了一段时间。 The rationale删除由 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().
在this other post他补充道:
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?
关于java - java.util.stream.Streamable 发生了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21985854/