分类 | Flow | Channel | Sequence/Iterable |
---|---|---|---|
入队 | emit | send | yield |
出队 | collect | receive consumeEach | forEach |
编号 | withIndex | withIndex | |
取值 | first last single | getOrElse | first last single |
查值 | containts elementAt find indexOf | ||
归约 | fold reduce scan | fold reduce scan | |
统计 | count | count all any average maxOf minOf sum | |
Map化 | associate groupBy | ||
局部 | take drop | take drop windowed | |
过滤 | filter | filter | |
映射 | map | map | |
变换 | transform | ||
任意组合 | combine | ||
配对组合 | zip | zip zipWithNext | |
解配对 | unzip | ||
合并 | merge (FIFO) | plus (连接) | |
二分 | partition | ||
平坦化 | flatMap flattenConcat flattenMerge | flatMap flatten | |
内组合 | chunked | ||
时间去抖 | debounce sample | ticker | |
值去抖 | distinctUntilChanged | distinct | |
集合运算 | minus intersect subtract union | ||
重排 | shuffled sorted | ||
缓冲 | buffer stateIn sharedIn | ||
事件 | onStart onCompletion onEmpty onEach | onClosed onSuccess onFailure onReciveOrNull | onEach |
[Kotlin] Flow, Channel, Sequence, Iterable的接口对比
最新推荐文章于 2023-01-06 22:17:37 发布