Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created April 12, 2012 12:13
Show Gist options
  • Save mathieuancelin/2366858 to your computer and use it in GitHub Desktop.
Save mathieuancelin/2366858 to your computer and use it in GitHub Desktop.
@Inject Service<SocialProvider> providers;
public List<Post> getTimeline() {
List<Post> timeline = new ArrayList<Post>();
for (SocialProvider provider : providers) {
    timeline.addAll(provider.getTimeline());
}
Collections.sort(timeline, new Comparator<Post>() {
public int compare(Post post1, Post post2) {
return post1.timestamp().compare(post2.timestamp());
}
});
return timeline;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment