Skip to content

Instantly share code, notes, and snippets.

@patrykpoborca
Last active February 4, 2016 20:55
Show Gist options
  • Save patrykpoborca/4dc00b0bd97b8f826b5c to your computer and use it in GitHub Desktop.
Save patrykpoborca/4dc00b0bd97b8f826b5c to your computer and use it in GitHub Desktop.
observable.let {
stream ->
if(someState)
stream
else
stream.filter { obj -> condition(obj) }
}
.debounce(3, TimeUnit.SECONDS)
.let{
stream ->
when(otherState){
STATE_1 -> stream.mergeWith(otherStream)
STATE_2 -> stream.mergeWith(secondStream)
STATE_3 -> stream.debounce(3, TimeUnit.SECONDS);
else -> stream
}
}
.subscribe{
//do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment