SimpleChannelIteratorItems

class SimpleChannelIteratorItems<out T>(channelIteratorFactory: (Items.PreprocessingProperties) -> ChannelIterator<T>) : BaseItems<T, SimpleChannelIteratorItems<T>>

Items 的基础实现,通过一个构建 ChannelIterator 的函数实现 Items 约定的功能。

Author

ForteScarlet

Constructors

Link copied to clipboard
fun <out T> SimpleChannelIteratorItems(channelIteratorFactory: (Items.PreprocessingProperties) -> ChannelIterator<T>)

Functions

Link copied to clipboard
open override fun asFlow(): Flow<T>

将当前元素序列转化为 Flow

Link copied to clipboard
open override fun asSequence(): Sequence<T>

将当前元素序列转化为 Sequence.

Link copied to clipboard
open override fun asStream(): Stream<out T>

将当前元素序列转化为 Stream.

Link copied to clipboard
open override fun batch(size: Int): SimpleChannelIteratorItems<T>

批次数量。如果支持批次获取的话,则每批次获取 size 的数。通常 size 0 时有效。

Link copied to clipboard
open fun collect(collector: Consumer<in T>)

阻塞地收集当前序列中的元素。

open suspend override fun collect(collector: suspend (T) -> Unit)

收集当前数据序列中的元素. collectTo 可能会产生挂起,会直到当前序列中的所有可能产生的元素收集完毕后结束挂起。

Link copied to clipboard
open fun collectAsync(collector: Consumer<in T>): CompletableFuture<Unit>

异步地收集当前序列中的元素。

Link copied to clipboard
open fun <C : MutableCollection<in T>> collectTo(collector: C): C

阻塞地收集当前序列中的元素到目标 collector 中。

Link copied to clipboard
open fun <C : MutableCollection<in T>> collectToAsync(collector: C): CompletableFuture<out C>

异步的将内容元素收集到 collector 中。

Link copied to clipboard
open fun collectToList(): List<T>

阻塞的收集当前序列中的元素到列表中。

Link copied to clipboard

异步收集当前序列中的元素到列表中。

Link copied to clipboard
open override fun limit(count: Int): SimpleChannelIteratorItems<T>

数据限流。取得的数据条数的最大上限。当 count< 0 时无效。

Link copied to clipboard
open override fun offset(count: Int): SimpleChannelIteratorItems<T>

数据偏移。从 count 数量之后的数据后开始获取。当 count< 0 时无效。

Extensions

Link copied to clipboard
inline fun <B, T> Items<B>.map(crossinline transform: suspend (B) -> T): Items<T>

转化一个 Items 中的元素类型并得到新的 Items 实例。

Link copied to clipboard
inline suspend fun <T, C : MutableCollection<T>> Items<T>.toCollection(collection: C): C

Items 中的元素收集为目标集合 C.

Link copied to clipboard
inline suspend fun <T> Items<T>.toList(): List<T>

Items 中的元素收集为 List.

Link copied to clipboard
fun <B, T> Items<B>.transform(transform: suspend (B) -> T): Items<T>

转化一个 Items 中的元素类型并得到新的 Items 实例。

Link copied to clipboard
@JvmName(name = "transform")
fun <B, T> Items<B>.transformBlocking(transform: (B) -> T): Items<T>

转化一个 Items 中的元素类型并得到新的 Items 实例。

Link copied to clipboard
fun <T> Items<T>.withLimiter(limiter: Limiter): Items<T>

通过 LimiterItems 的预处理参数进行处理。