diff --git a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java index 509ff42..af2a911 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java @@ -5,10 +5,6 @@ import java.util.HashMap; import java.util.HashSet; - -import java.util.HashMap; -import java.util.HashSet; - @Repository public class FavoriteManager { private final AccountManager accountManager; @@ -36,10 +32,9 @@ if(!favoritedMap.containsKey(accountId)) { //accountがなかったらbookidとotheraccountsの空のハッシュマップを用意 favoritedMap.put(accountId, new HashMap<>()); } - if(!favoritedMap.containsKey(bookId)) { //accountがなかったらbookidとotheraccountsの空のハッシュマップを用意 + if(!favoritedMap.get(accountId).containsKey(bookId)) { //bookIdがなかったらotheraccountsの空のハッシュセットを用意 favoritedMap.get(accountId).put(bookId, new HashSet<>()); } - favoritedMap.get(accountId).get(bookId).add(otherAccountId); } //delete @@ -51,7 +46,7 @@ - HashMap>> favoritesMap = new HashMap(); + HashMap>> favoritesMap = new HashMap<>(); //いいねした本の一覧を返す