diff --git a/core/src/main/java/com/m3u/core/util/coroutine/Flows.kt b/core/src/main/java/com/m3u/core/util/coroutine/Flows.kt index 2203fd5bc..8139602e6 100644 --- a/core/src/main/java/com/m3u/core/util/coroutine/Flows.kt +++ b/core/src/main/java/com/m3u/core/util/coroutine/Flows.kt @@ -19,8 +19,8 @@ fun Flow.timeout(duration: Duration, block: FlowCollector.() -> Unit) } fun flatmapCombined( - flows: Iterable>, - transform: (keys: Array) -> Flow + flows: Iterable>, + transform: (keys: Array) -> Flow ): Flow = combine(flows) { it }.flatMapLatest { keys -> transform(keys) } @Suppress("UNCHECKED_CAST") @@ -28,7 +28,7 @@ fun flatmapCombined( flow1: Flow, flow2: Flow, transform: (t1: T1, t2: T2) -> Flow -): Flow where T1 : Any, T2 : Any, R : Any = flatmapCombined(listOf(flow1, flow2)) { keys -> +): Flow = flatmapCombined(listOf(flow1, flow2)) { keys -> transform(keys[0] as T1, keys[1] as T2) } @@ -38,10 +38,9 @@ fun flatmapCombined( flow2: Flow, flow3: Flow, transform: (t1: T1, t2: T2, t3: T3) -> Flow -): Flow where T1 : Any, T2 : Any, T3 : Any, R : Any = - flatmapCombined(listOf(flow1, flow2, flow3)) { keys -> - transform(keys[0] as T1, keys[1] as T2, keys[2] as T3) - } +): Flow = flatmapCombined(listOf(flow1, flow2, flow3)) { keys -> + transform(keys[0] as T1, keys[1] as T2, keys[2] as T3) +} @Suppress("UNCHECKED_CAST") fun flatmapCombined( @@ -50,7 +49,6 @@ fun flatmapCombined( flow3: Flow, flow4: Flow, transform: (t1: T1, t2: T2, t3: T3, t4: T4) -> Flow -): Flow where T1 : Any, T2 : Any, T3 : Any, T4 : Any, R : Any = - flatmapCombined(listOf(flow1, flow2, flow3, flow4)) { keys -> - transform(keys[0] as T1, keys[1] as T2, keys[2] as T3, keys[3] as T4) - } +): Flow = flatmapCombined(listOf(flow1, flow2, flow3, flow4)) { keys -> + transform(keys[0] as T1, keys[1] as T2, keys[2] as T3, keys[3] as T4) +}