有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java发生了什么。util。流动可流动的?

早期的jdk8-eajavadocslike this表明存在一个java.util.stream.Streamable接口,它与Stream的关系似乎与IterableIterator的关系相同

现在我们似乎被Supplier<Stream>困住了,这肯定是不一样的

{}发生了什么事


共 (1) 个答案

  1. # 1 楼答案

    它在一段时间前被移除了The rationaleBrian 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().

    在{a3}中,他补充说:

    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?