java.util.stream.Streamable 发生了什么?

What happened to java.util.stream.Streamable?(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 发生了什么?

基础教程推荐