X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryBookmarkDatabase.java;h=1a4e1193327c3c660a4df5473e40ecc625b91da5;hb=ae0140e054f0e2cb4e0385951224a625cdf7f9a2;hp=594cf2b3bc05a1afcc82f8a19355eee1604ae1ad;hpb=39f730db92c425a510e19d33ba06b722c3dc299f;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabase.java
index 594cf2b..1a4e119 100644
--- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabase.java
+++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabase.java
@@ -1,5 +1,6 @@
package net.pterodactylus.sone.database.memory;
+import static com.google.common.base.Optional.fromNullable;
import static com.google.common.collect.FluentIterable.from;
import java.util.HashSet;
@@ -15,15 +16,13 @@ import com.google.common.base.Function;
/**
* Memory-based {@link BookmarkDatabase} implementation.
- *
- * @author David âBombeâ Roden
*/
public class MemoryBookmarkDatabase implements BookmarkDatabase {
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final MemoryDatabase memoryDatabase;
private final ConfigurationLoader configurationLoader;
- private final Set bookmarkedPosts = new HashSet();
+ private final Set bookmarkedPosts = new HashSet<>();
public MemoryBookmarkDatabase(MemoryDatabase memoryDatabase,
ConfigurationLoader configurationLoader) {
@@ -99,7 +98,7 @@ public class MemoryBookmarkDatabase implements BookmarkDatabase {
new Function() {
@Override
public Post apply(String postId) {
- return memoryDatabase.getPost(postId)
+ return fromNullable(memoryDatabase.getPost(postId))
.or(new EmptyPost(postId));
}
}).toSet();