What happened to java.util.stream.Streamable?(java.util.stream.Streamable 发生了什么?)
问题描述
早期jdk8-ea
javadocs 像这样 表示有一个 java.util.stream.Streamable
接口,它与 Stream
的关系似乎与 Iterable
相同必须有一个 Iterator
.
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
.
现在我们似乎被 Supplier
困住了,这肯定是不一样的.
Now it seems like we're stuck with Supplier<Stream>
, which is certainly not the same.
Streamable
发生了什么?
推荐答案
前段时间已下架.理由 删除由 Brian Goetz 给出:
It's been removed some time ago. The rationale for the removal was given by Brian Goetz:
目前唯一实现者是 Collection,以及所有其他流承载方法正在提供专门的流(chars()、codePoints()、lines() 等)使用比流"更合适的方法名称.所以我认为我们应该删除 Streamable 并保留 stream()/parallel() 方法集合(或可能将它们向上移动 Iterable).
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).
还有:
我开始认为 Streamable 没有发挥作用.ID喜欢考虑放弃 Streamable,此时最基础的parallel() 的实现在 Collection 中,我还建议我们考虑将其重命名为 parallelStream().
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().
在 其他帖子中 他补充道:
如果所有可迭代的东西都是有效的Streamable(因为 Iterable 有一个 stream())方法,以及一切Streamable 实际上是 Iterable(因为您可以将 Spliterator到一个迭代器),那么它们不是同一个抽象吗?
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.util.stream.Streamable 发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:java.util.stream.Streamable 发生了什么?
基础教程推荐
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01