GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — squid:S1319 - Declarations should use Java collection interfaces such… · coding0011/java-design-patterns@e4c34b1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • caching/src/main/java/com/iluwatar/caching
    • CacheStore.java
    • DbManager.java
    • LruCache.java
  • fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable
    • FluentIterable.java
  • iterator/src/main/java/com/iluwatar/iterator
    • TreasureChest.java
  • observer/src/test/java/com/iluwatar/observer
    • HobbitsTest.java
    • OrcsTest.java
    • generic
      • GHobbitsTest.java
      • OrcsTest.java
  • producer-consumer/src/main/java/com/iluwatar/producer/consumer
    • ItemQueue.java
  • servant/src/main/java/com/iluwatar/servant
    • Servant.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎caching/src/main/java/com/iluwatar/caching/CacheStore.java‎

Copy file name to clipboardExpand all lines: caching/src/main/java/com/iluwatar/caching/CacheStore.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package com.iluwatar.caching;
2424

25-
import java.util.ArrayList;
25+
import java.util.List;
2626

2727
/**
2828
*
@@ -134,7 +134,7 @@ public static void flushCache() {
134134
if (null == cache) {
135135
return;
136136
}
137-
ArrayList<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm();
137+
List<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm();
138138
for (UserAccount userAccount : listOfUserAccounts) {
139139
DbManager.upsertDb(userAccount);
140140
}
@@ -144,7 +144,7 @@ public static void flushCache() {
144144
* Print user accounts
145145
*/
146146
public static String print() {
147-
ArrayList<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm();
147+
List<UserAccount> listOfUserAccounts = cache.getCacheDataInListForm();
148148
StringBuilder sb = new StringBuilder();
149149
sb.append("\n--CACHE CONTENT--\n");
150150
for (UserAccount userAccount : listOfUserAccounts) {
Collapse file

‎caching/src/main/java/com/iluwatar/caching/DbManager.java‎

Copy file name to clipboardExpand all lines: caching/src/main/java/com/iluwatar/caching/DbManager.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.text.ParseException;
2626
import java.util.HashMap;
27+
import java.util.Map;
2728

2829
import org.bson.Document;
2930

@@ -49,7 +50,7 @@ public final class DbManager {
4950
private static MongoDatabase db;
5051
private static boolean useMongoDB;
5152

52-
private static HashMap<String, UserAccount> virtualDB;
53+
private static Map<String, UserAccount> virtualDB;
5354

5455
private DbManager() {
5556
}
Collapse file

‎caching/src/main/java/com/iluwatar/caching/LruCache.java‎

Copy file name to clipboardExpand all lines: caching/src/main/java/com/iluwatar/caching/LruCache.java
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import java.util.ArrayList;
2626
import java.util.HashMap;
27+
import java.util.List;
28+
import java.util.Map;
2729

2830
/**
2931
*
@@ -49,7 +51,7 @@ public Node(String userId, UserAccount userAccount) {
4951
}
5052

5153
int capacity;
52-
HashMap<String, Node> cache = new HashMap<>();
54+
Map<String, Node> cache = new HashMap<>();
5355
Node head;
5456
Node end;
5557

@@ -161,7 +163,7 @@ public void clear() {
161163
*
162164
* Returns cache data in list form.
163165
*/
164-
public ArrayList<UserAccount> getCacheDataInListForm() {
166+
public List<UserAccount> getCacheDataInListForm() {
165167
ArrayList<UserAccount> listOfCacheData = new ArrayList<>();
166168
Node temp = head;
167169
while (temp != null) {
Collapse file

‎fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java‎

Copy file name to clipboardExpand all lines: fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public interface FluentIterable<E> extends Iterable<E> {
101101
* @return a list with all objects of the given iterator
102102
*/
103103
static <E> List<E> copyToList(Iterable<E> iterable) {
104-
ArrayList<E> copy = new ArrayList<>();
104+
List<E> copy = new ArrayList<>();
105105
Iterator<E> iterator = iterable.iterator();
106106
while (iterator.hasNext()) {
107107
copy.add(iterator.next());
Collapse file

‎iterator/src/main/java/com/iluwatar/iterator/TreasureChest.java‎

Copy file name to clipboardExpand all lines: iterator/src/main/java/com/iluwatar/iterator/TreasureChest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ItemIterator iterator(ItemType itemType) {
5959
* Get all items
6060
*/
6161
public List<Item> getItems() {
62-
ArrayList<Item> list = new ArrayList<>();
62+
List<Item> list = new ArrayList<>();
6363
list.addAll(items);
6464
return list;
6565
}
Collapse file

‎observer/src/test/java/com/iluwatar/observer/HobbitsTest.java‎

Copy file name to clipboardExpand all lines: observer/src/test/java/com/iluwatar/observer/HobbitsTest.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import java.util.ArrayList;
2929
import java.util.Collection;
30+
import java.util.List;
3031

3132
/**
3233
* Date: 12/27/15 - 12:07 PM
@@ -38,7 +39,7 @@ public class HobbitsTest extends WeatherObserverTest<Hobbits> {
3839

3940
@Parameterized.Parameters
4041
public static Collection<Object[]> data() {
41-
final ArrayList<Object[]> testData = new ArrayList<>();
42+
final List<Object[]> testData = new ArrayList<>();
4243
testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."});
4344
testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."});
4445
testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."});
Collapse file

‎observer/src/test/java/com/iluwatar/observer/OrcsTest.java‎

Copy file name to clipboardExpand all lines: observer/src/test/java/com/iluwatar/observer/OrcsTest.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import java.util.ArrayList;
2929
import java.util.Collection;
30+
import java.util.List;
3031

3132
/**
3233
* Date: 12/27/15 - 12:07 PM
@@ -38,7 +39,7 @@ public class OrcsTest extends WeatherObserverTest<Orcs> {
3839

3940
@Parameterized.Parameters
4041
public static Collection<Object[]> data() {
41-
final ArrayList<Object[]> testData = new ArrayList<>();
42+
final List<Object[]> testData = new ArrayList<>();
4243
testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."});
4344
testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."});
4445
testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."});
Collapse file

‎observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java‎

Copy file name to clipboardExpand all lines: observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import java.util.ArrayList;
3333
import java.util.Collection;
34+
import java.util.List;
3435

3536
/**
3637
* Date: 12/27/15 - 12:07 PM
@@ -42,7 +43,7 @@ public class GHobbitsTest extends ObserverTest<GHobbits> {
4243

4344
@Parameterized.Parameters
4445
public static Collection<Object[]> data() {
45-
final ArrayList<Object[]> testData = new ArrayList<>();
46+
final List<Object[]> testData = new ArrayList<>();
4647
testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."});
4748
testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."});
4849
testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."});
Collapse file

‎observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java‎

Copy file name to clipboardExpand all lines: observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import java.util.ArrayList;
3131
import java.util.Collection;
32+
import java.util.List;
3233

3334
/**
3435
* Date: 12/27/15 - 12:07 PM
@@ -40,7 +41,7 @@ public class OrcsTest extends ObserverTest<GOrcs> {
4041

4142
@Parameterized.Parameters
4243
public static Collection<Object[]> data() {
43-
final ArrayList<Object[]> testData = new ArrayList<>();
44+
final List<Object[]> testData = new ArrayList<>();
4445
testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."});
4546
testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."});
4647
testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."});
Collapse file

‎producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java‎

Copy file name to clipboardExpand all lines: producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
*/
2323
package com.iluwatar.producer.consumer;
2424

25+
import java.util.concurrent.BlockingQueue;
2526
import java.util.concurrent.LinkedBlockingQueue;
2627

2728
/**
2829
* Class as a channel for {@link Producer}-{@link Consumer} exchange.
2930
*/
3031
public class ItemQueue {
3132

32-
private LinkedBlockingQueue<Item> queue;
33+
private BlockingQueue<Item> queue;
3334

3435
public ItemQueue() {
3536

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.