Skip to content

Instantly share code, notes, and snippets.

@nhphong
Created July 8, 2019 03:22
Show Gist options
  • Save nhphong/2fd3e644b97f0f2bb4e780c045398ae5 to your computer and use it in GitHub Desktop.
Save nhphong/2fd3e644b97f0f2bb4e780c045398ae5 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