加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

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

发布时间:2020-12-14 05:07:38 所属栏目:Java 来源:网络整理
导读:早期的jdk8-ea javadocs like this表示有一个java.util.stream.Streamable接口,它似乎与Iterable对Iterator具有相同的关系. 现在看来,我们被困在供应商 Stream,这肯定是不一样的. Streamable发生了什么? 解决方法 之前已经删除了.删除的 The rationale由Bri
早期的jdk8-ea javadocs like this表示有一个java.util.stream.Streamable接口,它似乎与Iterable对Iterator具有相同的关系.

现在看来,我们被困在供应商< 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?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读