squid:S1319 - Declarations should use Java collection interfaces such as List rather than specific implementation classes such as LinkedList
This commit is contained in:
		| @@ -22,7 +22,7 @@ | ||||
|  */ | ||||
| package com.iluwatar.caching; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -134,7 +134,7 @@ public class CacheStore { | ||||
|     if (null == cache) { | ||||
|       return; | ||||
|     } | ||||
|     ArrayList<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm(); | ||||
|     List<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm(); | ||||
|     for (UserAccount userAccount : listOfUserAccounts) { | ||||
|       DbManager.upsertDb(userAccount); | ||||
|     } | ||||
| @@ -144,7 +144,7 @@ public class CacheStore { | ||||
|    * Print user accounts | ||||
|    */ | ||||
|   public static String print() { | ||||
|     ArrayList<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm(); | ||||
|     List<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm(); | ||||
|     StringBuilder sb = new StringBuilder(); | ||||
|     sb.append("\n--CACHE CONTENT--\n"); | ||||
|     for (UserAccount userAccount : listOfUserAccounts) { | ||||
|   | ||||
| @@ -24,6 +24,7 @@ package com.iluwatar.caching; | ||||
|  | ||||
| import java.text.ParseException; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.bson.Document; | ||||
|  | ||||
| @@ -49,7 +50,7 @@ public final class DbManager { | ||||
|   private static MongoDatabase db; | ||||
|   private static boolean useMongoDB; | ||||
|  | ||||
|   private static HashMap<String, UserAccount> virtualDB; | ||||
|   private static Map<String, UserAccount> virtualDB; | ||||
|  | ||||
|   private DbManager() { | ||||
|   } | ||||
|   | ||||
| @@ -24,6 +24,8 @@ package com.iluwatar.caching; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -49,7 +51,7 @@ public class LruCache { | ||||
|   } | ||||
|  | ||||
|   int capacity; | ||||
|   HashMap<String, Node> cache = new HashMap<>(); | ||||
|   Map<String, Node> cache = new HashMap<>(); | ||||
|   Node head; | ||||
|   Node end; | ||||
|  | ||||
| @@ -161,7 +163,7 @@ public class LruCache { | ||||
|    * | ||||
|    * Returns cache data in list form. | ||||
|    */ | ||||
|   public ArrayList<UserAccount> getCacheDataInListForm() { | ||||
|   public List<UserAccount> getCacheDataInListForm() { | ||||
|     ArrayList<UserAccount> listOfCacheData = new ArrayList<>(); | ||||
|     Node temp = head; | ||||
|     while (temp != null) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user