Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 6907da4

Browse files
George Kankavaniftynei
authored andcommitted
squid:S1319 - Declarations should use Java collection interfaces such as 'List' rather than specific implementation classes such as 'LinkedList'
1 parent 3c4230c commit 6907da4

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

app/src/main/java/com/zulip/android/AsyncGetOldMessages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
public class AsyncGetOldMessages extends ZulipAsyncPushTask {
2121
MessageListener listener;
22-
public ArrayList<Message> receivedMessages;
22+
public List<Message> receivedMessages;
2323
MessageListener.LoadPosition position;
2424
protected MessageRange rng;
2525
protected int mainAnchor;

app/src/main/java/com/zulip/android/AsyncStatusUpdate.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package com.zulip.android;
22

33
import android.content.Context;
4-
import android.os.*;
5-
import android.os.Message;
64
import android.util.Log;
75
import android.widget.Toast;
86

9-
import org.json.JSONArray;
107
import org.json.JSONException;
118
import org.json.JSONObject;
129

1310
import java.util.Iterator;
14-
import java.util.concurrent.ConcurrentHashMap;
11+
import java.util.Map;
1512

1613
/**
1714
* Sends a status update and fetches updates for other users.
@@ -94,7 +91,7 @@ protected void onPostExecute(String result) {
9491

9592
if (obj.getString("result").equals("success")) {
9693

97-
ConcurrentHashMap<String, Presence> presenceLookup = this.app.presences;
94+
Map<String, Presence> presenceLookup = this.app.presences;
9895
presenceLookup.clear();
9996

10097
JSONObject presences = obj.getJSONObject("presences");

app/src/main/java/com/zulip/android/Message.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.ArrayList;
55
import java.util.Arrays;
66
import java.util.Date;
7-
import java.util.HashMap;
87
import java.util.List;
8+
import java.util.Map;
99
import java.util.concurrent.Callable;
1010

1111
import org.apache.commons.lang.builder.EqualsBuilder;
@@ -84,8 +84,8 @@ static String recipientList(Person[] recipients) {
8484
* @throws JSONException
8585
*/
8686
public Message(ZulipApp app, JSONObject message,
87-
HashMap<String, Person> personCache,
88-
HashMap<String, Stream> streamCache) throws JSONException {
87+
Map<String, Person> personCache,
88+
Map<String, Stream> streamCache) throws JSONException {
8989
this.setID(message.getInt("id"));
9090
this.setSender(Person.getOrUpdate(app,
9191
message.getString("sender_email"),

app/src/main/java/com/zulip/android/Person.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.zulip.android;
22

3-
import android.database.Cursor;
4-
53
import java.sql.SQLException;
64
import java.util.Collections;
75
import java.util.Comparator;
@@ -13,7 +11,6 @@
1311
import org.json.JSONException;
1412
import org.json.JSONObject;
1513

16-
import com.j256.ormlite.android.AndroidDatabaseResults;
1714
import com.j256.ormlite.dao.Dao;
1815
import com.j256.ormlite.dao.RuntimeExceptionDao;
1916
import com.j256.ormlite.field.DatabaseField;
@@ -137,7 +134,7 @@ static Person getByEmail(ZulipApp app, String email) {
137134
}
138135

139136
public static Person getOrUpdate(ZulipApp app, String email, String name,
140-
String avatarURL, HashMap<String, Person> personCache) {
137+
String avatarURL, Map<String, Person> personCache) {
141138

142139
Person person = null;
143140

app/src/main/java/com/zulip/android/ZulipApp.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.zulip.android;
22

33
import java.sql.SQLException;
4+
import java.util.Map;
5+
import java.util.Queue;
46
import java.util.concurrent.ConcurrentHashMap;
57
import java.util.concurrent.ConcurrentLinkedQueue;
68

@@ -44,13 +46,13 @@ public class ZulipApp extends Application {
4446
* Mapping of email address to presence information for that user. This is
4547
* updated every 2 minutes by a background thread (see AsyncStatusUpdate)
4648
*/
47-
public final ConcurrentHashMap<String, Presence> presences = new ConcurrentHashMap<String, Presence>();
49+
public final Map<String, Presence> presences = new ConcurrentHashMap<String, Presence>();
4850

4951
/**
5052
* Queue of message ids to be marked as read. This queue should be emptied
5153
* every couple of seconds
5254
*/
53-
public final ConcurrentLinkedQueue<Integer> unreadMessageQueue = new ConcurrentLinkedQueue<Integer>();
55+
public final Queue<Integer> unreadMessageQueue = new ConcurrentLinkedQueue<Integer>();
5456

5557
public static ZulipApp get() {
5658
return instance;

0 commit comments

Comments
 (0)