Skip to content

Instantly share code, notes, and snippets.

@nhphong
Last active July 20, 2019 03:31
Show Gist options
  • Save nhphong/32d4eeb3577ab7f981545aae0e905e2e to your computer and use it in GitHub Desktop.
Save nhphong/32d4eeb3577ab7f981545aae0e905e2e to your computer and use it in GitHub Desktop.
val source = PublishSubject.create<Int>()
source
.debounceIf({ it.isOdd }, 2, SECONDS, Schedulers.io())
.subscribe { print(it) }
source.onNext(1)
source.onNext(2)
source.onNext(3)
source.onNext(4)
Thread.sleep(10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment