asStream

Converts an IterableCollectable to a Stream.

Return

the Stream representation of the IterableCollectable.

See also


Converts an SequenceCollectable to a Stream.

Return

the Stream representation of the SequenceCollectable.

See also


fun <T> Collectable<T>.asStream(produceScope: CoroutineScope? = null): Stream<T>(source)

将一个 Collectable 转化为 Stream。 如果是 IterableCollectableSequenceCollectable, 则会使用它们的 asSequence 进行转化, 否则会使用 Collectable 中合适的方法进行适当的阻塞转化

如果 collectable 不是 IterableCollectableSequenceCollectable, 则需要提供 produceScope 来将异步的收集器转化为 stream。默认使用 GlobalScope。 注意:请参考并了解有关 GlobalScope 的各种注意事项,避免出现预期外的结果或错误。

Parameters

produceScope

如果 collectable 不是 IterableCollectableSequenceCollectable, 则需要提供一个作用域来将异步的收集器转化为 stream。默认使用 GlobalScope。 注意:请参考并了解有关 GlobalScope 的各种注意事项,避免出现预期外的结果或错误。