Skip to content

Commit

Permalink
Sorting news based on date (most recent first)
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jul 18, 2014
1 parent fb581d2 commit 105aad2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
Expand Down Expand Up @@ -183,6 +185,14 @@ public List<Document> getRelatedDocuments(Addon addon, int count)
public List<News> getAllNews()
{
List<News> news = fetchYamlList(SiteConstants.DOCS_REPO_URL_NEWS, News.class);
Collections.sort(news, new Comparator<News>()
{
@Override
public int compare(News o1, News o2)
{
return o2.getDate().compareTo(o1.getDate());
}
});
return news;
}

Expand Down

0 comments on commit 105aad2

Please sign in to comment.