/*
- * Sone - ListNotificationFilter.java - Copyright © 2010–2015 David Roden
+ * Sone - ListNotificationFilter.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* Filter for {@link ListNotification}s.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
@Singleton
public class ListNotificationFilter {
*/
@SuppressWarnings("unchecked")
public List<Notification> filterNotifications(Collection<? extends Notification> notifications, Sone currentSone) {
- List<Notification> filteredNotifications = new ArrayList<Notification>();
+ List<Notification> filteredNotifications = new ArrayList<>();
for (Notification notification : notifications) {
if (notification.getId().equals("new-sone-notification")) {
if ((currentSone != null) && !currentSone.getOptions().isShowNewSoneNotifications()) {
if (newPosts.size() == postNotification.getElements().size()) {
return Optional.of(postNotification);
}
- ListNotification<Post> filteredNotification = new ListNotification<Post>(postNotification);
+ ListNotification<Post> filteredNotification = new ListNotification<>(postNotification);
filteredNotification.setElements(newPosts);
filteredNotification.setLastUpdateTime(postNotification.getLastUpdatedTime());
return Optional.of(filteredNotification);
if (newReplies.size() == newReplyNotification.getElements().size()) {
return Optional.of(newReplyNotification);
}
- ListNotification<PostReply> filteredNotification = new ListNotification<PostReply>(newReplyNotification);
+ ListNotification<PostReply> filteredNotification = new ListNotification<>(newReplyNotification);
filteredNotification.setElements(newReplies);
filteredNotification.setLastUpdateTime(newReplyNotification.getLastUpdatedTime());
return Optional.of(filteredNotification);