X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fpnews%2FMain.java;h=064d597c16dcab99f2ecb56b300654571055fbcd;hb=abd88d90605e6a3292ea2c778ec962303c1f5bc8;hp=35962bc6c54a0a54baa5a916253db253a50f1dd5;hpb=4de6eb9b972d582a23e55b0c73187a1a8242edb5;p=pnews.git diff --git a/src/main/java/pnews/Main.java b/src/main/java/pnews/Main.java index 35962bc..064d597 100644 --- a/src/main/java/pnews/Main.java +++ b/src/main/java/pnews/Main.java @@ -8,6 +8,7 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import com.rometools.rome.feed.synd.SyndEnclosure; @@ -16,6 +17,8 @@ import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.FeedException; import com.rometools.rome.io.SyndFeedInput; import com.rometools.rome.io.XmlReader; +import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils.Collections; + import org.jsoup.*; public class Main { @@ -40,7 +43,9 @@ public class Main { cat, entry.getTitle(), desc, - thumbnail)); + thumbnail, + entry.getPublishedDate(), + feed.getTitle())); } } @@ -76,6 +81,13 @@ public class Main { throw new IllegalArgumentException(); } + articles.sort(new Comparator
() { + @Override + public int compare(Article o1, Article o2) { + return o2.publicationDate.compareTo(o1.publicationDate); + } + }); + return articles; }