Skip to content

Commit

Permalink
fix flatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
dqh147258 committed Sep 26, 2022
1 parent 8506556 commit a63187d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fun <T, D, R> Observable<Pair<T, D>>.map(block: (t: T, d: D) -> R): Observable<R
return map { block(it.first, it.second) }
}

fun <T, D, R> Observable<Pair<T, D>>.flatMap(block: (t: T, d: D) -> R): Observable<R> {
return flatMap { Observable.just(block(it.first, it.second)) }
fun <T, D, R> Observable<Pair<T, D>>.flatMap(block: (t: T, d: D) -> Observable<R>): Observable<R> {
return flatMap { block(it.first, it.second) }
}

fun <F, S, T> Observable<F>.pairWith(second: S, third: T): Observable<ThreePair<F, S, T>> {
Expand All @@ -25,7 +25,7 @@ fun <F, S, T, R> Observable<ThreePair<F, S, T>>.map(block: (f: F, s: S, t: T) ->
return map { block(it.first, it.second, it.third) }
}

fun <F, S, T, R> Observable<ThreePair<F, S, T>>.flatMap(block: (f: F, s: S, t: T) -> R): Observable<R> {
return flatMap { Observable.just(block(it.first, it.second, it.third)) }
fun <F, S, T, R> Observable<ThreePair<F, S, T>>.flatMap(block: (f: F, s: S, t: T) -> Observable<R>): Observable<R> {
return flatMap { block(it.first, it.second, it.third) }
}

0 comments on commit a63187d

Please sign in to comment.