groupConsecutiveBy

fun <T, K> <Error class: unknown class><T>.groupConsecutiveBy(keySelector: (T) -> K): <Error class: unknown class><List<T>>

Groups a Flow into a Flow> by grouping consecutive elements that share the same key, as determined by keySelector.

A new chunk begins whenever the key changes.

Example: flowOf(1, 1, 2, 2, 2, 1, 3).groupConsecutiveBy { it } → 1, 1, 2, 2, 2, 1, 3