X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FSoneImpl.java;h=ce0f5c1dc3b8ec899aaff29e731e2a0b35fd761a;hp=049460727198e6166cbfe8224d49f628a7b0de4f;hb=179e7da4d8d8a474d0b622d60b5f5d32d6ab4052;hpb=c56cbae5dd54a70fcdaea024d606dee69525c7e9 diff --git a/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java index 0494607..ce0f5c1 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java @@ -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. *

* Operations that modify the Sone need to synchronize on the Sone in question. - * - * @author David ‘Bombe’ Roden */ public class SoneImpl implements Sone { @@ -95,16 +93,16 @@ public class SoneImpl implements Sone { private volatile boolean known; /** All posts. */ - private final Set posts = new CopyOnWriteArraySet(); + private final Set posts = new CopyOnWriteArraySet<>(); /** All replies. */ - private final Set replies = new CopyOnWriteArraySet(); + private final Set replies = new CopyOnWriteArraySet<>(); /** The IDs of all liked posts. */ - private final Set likedPostIds = new CopyOnWriteArraySet(); + private final Set likedPostIds = new CopyOnWriteArraySet<>(); /** The IDs of all liked replies. */ - private final Set likedReplyIds = new CopyOnWriteArraySet(); + private final Set 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 getPosts() { List sortedPosts; synchronized (this) { - sortedPosts = new ArrayList(posts); + sortedPosts = new ArrayList<>(posts); } Collections.sort(sortedPosts, Post.NEWEST_FIRST); return sortedPosts; @@ -644,7 +642,7 @@ public class SoneImpl implements Sone { } hash.putString(")"); - List replies = new ArrayList(getReplies()); + List replies = new ArrayList<>(getReplies()); Collections.sort(replies, Reply.TIME_COMPARATOR); hash.putString("Replies("); for (PostReply reply : replies) { @@ -652,7 +650,7 @@ public class SoneImpl implements Sone { } hash.putString(")"); - List likedPostIds = new ArrayList(getLikedPostIds()); + List likedPostIds = new ArrayList<>(getLikedPostIds()); Collections.sort(likedPostIds); hash.putString("LikedPosts("); for (String likedPostId : likedPostIds) { @@ -660,7 +658,7 @@ public class SoneImpl implements Sone { } hash.putString(")"); - List likedReplyIds = new ArrayList(getLikedReplyIds()); + List likedReplyIds = new ArrayList<>(getLikedReplyIds()); Collections.sort(likedReplyIds); hash.putString("LikedReplies("); for (String likedReplyId : likedReplyIds) {