Skip to content

Instantly share code, notes, and snippets.

@pamartineza
Created September 7, 2018 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamartineza/045be68c0169cc4d1a814d85b463d7b5 to your computer and use it in GitHub Desktop.
Save pamartineza/045be68c0169cc4d1a814d85b463d7b5 to your computer and use it in GitHub Desktop.
//This observable timeline would be:
//0:00 Subscription takes place
//0:02 emits "0L" after 2 seconds
//0:04 emits "0L" after 4 seconds
//0:08 emits "0L" after 8 seconds
Observable.range(1,3).flatMap { retryCount ->
Observable.timer(Math.pow(2.toDouble(), retryCount.toDouble()).toLong(), TimeUnit.SECONDS)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment