Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created March 16, 2018 14:26
Show Gist options
  • Save deque-blog/c43497a3c80e7201e9791f8987d3843e to your computer and use it in GitHub Desktop.
Save deque-blog/c43497a3c80e7201e9791f8987d3843e to your computer and use it in GitHub Desktop.
class SuggestPopularFriendPost {
private final IAccessProfileInfo profileInfo; // Injected with constructor
public Iterable<PostSummary> suggestedPostsFor(ProfileId profileId) {
// Same code as before, calling `friendsOf`, `favoriteTopicsOf` and `lastPostsOf`
}
private Iterable<ProfileId> friendsOf(ProfileId profileId) {
return profileInfo.friendsOf(profileId); // Rerouting to `IAccessProfileInfo`
}
private Set<Topic> favoriteTopicsOf(ProfileId profileId) {
return profileInfo.favoriteTopicsOf(profileId);
}
private Stream<PostSummary> lastPostsOf(ProfileId profileId) {
return stream(profileInfo.lastPostsOf(profileId));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment