Skip to content

Instantly share code, notes, and snippets.

@michaelzengke
Created October 20, 2016 18:27
Show Gist options
  • Save michaelzengke/00b858a66580a0c9f42b74626a8a68cb to your computer and use it in GitHub Desktop.
Save michaelzengke/00b858a66580a0c9f42b74626a8a68cb to your computer and use it in GitHub Desktop.
Observable<MyStuff> myStuffRepository = Observable
.merge(savedJobPostingRepository.onErrorReturn(error -> null),
appliedJobPostingRepository.retry(1))
.reduce(new MyStuff(), (accumulated, item) -> {
switch (item.getEntityType()) {
case SavedJobs:
accumulated.savedJobPostings = item;
break;
case AppliedJobs:
accumulated.appliedJobPostings = item;
break;
}
return accumulated;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment