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 发生了什么?


- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 获取数字的最后一位 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01