Skip to content

Instantly share code, notes, and snippets.

@fullkomnun
Last active December 3, 2017 22:16
Show Gist options
  • Save fullkomnun/27319d04ad47540b1e4eb9324d419f72 to your computer and use it in GitHub Desktop.
Save fullkomnun/27319d04ad47540b1e4eb9324d419f72 to your computer and use it in GitHub Desktop.
private fun prefetchData(): Completable =
inParallel(
async1() andThen async2() andThen (async3() alongside async4()),
async1() andThen async5(),
async6() andThen async7())
fun inParallel(vararg sources: CompletableSource): Completable = Completable.mergeArray(*sources)
infix fun Completable.andThen(next: CompletableSource): Completable = this.andThen(next)
infix fun Completable.alongside(other: CompletableSource): Completable = this.mergeWith(other)
fun async1(): Completable { TODO("not implemented") }
fun async2(): Completable { TODO("not implemented") }
fun async3(): Completable { TODO("not implemented") }
fun async4(): Completable { TODO("not implemented") }
fun async5(): Completable { TODO("not implemented") }
fun async6(): Completable { TODO("not implemented") }
fun async7(): Completable { TODO("not implemented") }
private fun prefetchData(): Completable =
Completable.mergeArray(
async1().concatWith(async2()).concatWith(async3().mergeWith(async4())),
async1().concatWith(async5()),
async6().concatWith(async7()))
fun async1(): Completable { TODO("not implemented") }
fun async2(): Completable { TODO("not implemented") }
fun async3(): Completable { TODO("not implemented") }
fun async4(): Completable { TODO("not implemented") }
fun async5(): Completable { TODO("not implemented") }
fun async6(): Completable { TODO("not implemented") }
fun async7(): Completable { TODO("not implemented") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment