Created
October 20, 2016 18:26
-
-
Save michaelzengke/f759f517964279de50108002aeb4a386 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface MyStuffEntity { | |
EntityType getEntityType(); | |
} | |
public class MyStuff { | |
MyStuffEntity savedJobPostings; | |
MyStuffEntity appliedJobPostings; | |
} | |
Observable<MyStuff> myStuffRepository = Observable | |
.merge(savedJobPostingRepository, appliedJobPostingRepository) | |
.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