Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created April 2, 2018 12:25
Show Gist options
  • Save deque-blog/247be6b47d5ae88ad1d52fbded4482b8 to your computer and use it in GitHub Desktop.
Save deque-blog/247be6b47d5ae88ad1d52fbded4482b8 to your computer and use it in GitHub Desktop.
public Iterable<PostSummary> suggestedPostsFor(ProfileId profileId) {
Iterable<ProfileId> friendIds = friendsOf(profileId);
Set<Topic> topics = favoriteTopicsOf(profileId);
Stream<PostSummary> interestingPosts = stream(friendIds)
.flatMap(friendId -> lastPostsOf(friendId))
.filter(post -> post.isAbout(topics));
return mostLiked(3, interestingPosts);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment