Skip to content

Instantly share code, notes, and snippets.

@nsk-mironov
Created May 23, 2017 19:52
Show Gist options
  • Save nsk-mironov/5434a119481cca238df93ce04e82291b to your computer and use it in GitHub Desktop.
Save nsk-mironov/5434a119481cca238df93ce04e82291b to your computer and use it in GitHub Desktop.
fun <T> magic(jobs: Observable<Completable>, hot: Observable<T>): Observable<T> {
return jobs.startWith(Completable.never()).indexed().switchMap {
if (it.index == 0) hot else it.value.andThen(hot)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment