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

标签 java java-8 java-stream

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/

相关文章:

java - 如何比较 Java 8 中的两个流

java-8 - Java 8 的 ZonedDateTime 在转换时是否考虑夏令时?

java - 如何以 Java 8 方式获取特定 URL 上的文本行流?

Java 8 帖子分组依据

java - Hibernate EntityManagerFactory EntityManager

java - Android - GCM 推送通知未出现在通知列表中

使用 Apache POI 创建 .xlsx 文件时出现 java.lang.NoClassDefFoundError

java - 查找 Selenium WebDriver 中分页按钮的数量

Java Lambda 表达式和日志记录

java - 使用流 API 将 List<T> 转换为 Map<T.Prop, List<T>>