Update year in copyright lines
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / SoneImpl.java
index 439f4c9..ce0f5c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - SoneImpl.java - Copyright © 2010–2016 David Roden
+ * Sone - SoneImpl.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
@@ -56,8 +56,6 @@ import com.google.common.hash.Hashing;
  * {@link Sone} implementation.
  * <p/>
  * Operations that modify the Sone need to synchronize on the Sone in question.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public class SoneImpl implements Sone {
 
@@ -95,16 +93,16 @@ public class SoneImpl implements Sone {
        private volatile boolean known;
 
        /** All posts. */
-       private final Set<Post> posts = new CopyOnWriteArraySet<Post>();
+       private final Set<Post> posts = new CopyOnWriteArraySet<>();
 
        /** All replies. */
-       private final Set<PostReply> replies = new CopyOnWriteArraySet<PostReply>();
+       private final Set<PostReply> replies = new CopyOnWriteArraySet<>();
 
        /** The IDs of all liked posts. */
-       private final Set<String> likedPostIds = new CopyOnWriteArraySet<String>();
+       private final Set<String> likedPostIds = new CopyOnWriteArraySet<>();
 
        /** The IDs of all liked replies. */
-       private final Set<String> likedReplyIds = new CopyOnWriteArraySet<String>();
+       private final Set<String> likedReplyIds = new CopyOnWriteArraySet<>();
 
        /** The root album containing all albums. */
        private final Album rootAlbum = new AlbumImpl(this);
@@ -383,7 +381,7 @@ public class SoneImpl implements Sone {
        public List<Post> getPosts() {
                List<Post> sortedPosts;
                synchronized (this) {
-                       sortedPosts = new ArrayList<Post>(posts);
+                       sortedPosts = new ArrayList<>(posts);
                }
                Collections.sort(sortedPosts, Post.NEWEST_FIRST);
                return sortedPosts;
@@ -533,12 +531,9 @@ public class SoneImpl implements Sone {
         *
         * @param postId
         *              The ID of the post
-        * @return This Sone (for method chaining)
         */
-       @Nonnull
-       public Sone removeLikedPostId(@Nonnull String postId) {
+       public void removeLikedPostId(@Nonnull String postId) {
                likedPostIds.remove(postId);
-               return this;
        }
 
        /**
@@ -595,12 +590,9 @@ public class SoneImpl implements Sone {
         *
         * @param replyId
         *              The ID of the reply
-        * @return This Sone (for method chaining)
         */
-       @Nonnull
-       public Sone removeLikedReplyId(@Nonnull String replyId) {
+       public void removeLikedReplyId(@Nonnull String replyId) {
                likedReplyIds.remove(replyId);
-               return this;
        }
 
        /**
@@ -650,7 +642,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<PostReply> replies = new ArrayList<PostReply>(getReplies());
+               List<PostReply> replies = new ArrayList<>(getReplies());
                Collections.sort(replies, Reply.TIME_COMPARATOR);
                hash.putString("Replies(");
                for (PostReply reply : replies) {
@@ -658,7 +650,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<String> likedPostIds = new ArrayList<String>(getLikedPostIds());
+               List<String> likedPostIds = new ArrayList<>(getLikedPostIds());
                Collections.sort(likedPostIds);
                hash.putString("LikedPosts(");
                for (String likedPostId : likedPostIds) {
@@ -666,7 +658,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<String> likedReplyIds = new ArrayList<String>(getLikedReplyIds());
+               List<String> likedReplyIds = new ArrayList<>(getLikedReplyIds());
                Collections.sort(likedReplyIds);
                hash.putString("LikedReplies(");
                for (String likedReplyId : likedReplyIds) {