- synchronized(articlesByCategory) {
- link = entry.getLink().trim();
-
- articles = articlesByCategory.get(cat);
- exist = false;
- if (articles == null) {
- articles = new ArrayList<>();
- articlesByCategory.put(cat, articles);
- } else {
- for (Article a: articles)
- if (a.link.equals(link)) {
- LOG.fine("addArticles " + link + " is already present");
- exist = true;
- }
- }
-
- if (!exist) {
- LOG.fine("add " + cat.getId() + " " + feedTitle + " " + title);
-
- articles.add(new Article(link, cat, title, desc, thumbnail, date,
- feed.getTitle()));
-
- Collections.sort(articles, new Comparator<Article>() {
- @Override
- public int compare(Article o1, Article o2) {
- return o2.publicationDate.compareTo(o1.publicationDate);
- }