Skip to content

Instantly share code, notes, and snippets.

@nhphong
Created July 8, 2019 03:24
Show Gist options
  • Save nhphong/75ad65bcf72f7bcb95fa9b0134e5ba0d to your computer and use it in GitHub Desktop.
Save nhphong/75ad65bcf72f7bcb95fa9b0134e5ba0d to your computer and use it in GitHub Desktop.
fun <T> Observable<T>.debounceIf(
...
): Observable<T> {
return Observable.merge(
debounce(timeout, unit, scheduler)
.filter { predicate(it) }, // The first stream
filter { !predicate(it) } // The second stream
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment