微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

早期的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?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐