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

Commit 50c9ee7

Browse files
kunall17niftynei
authored andcommitted
 Explicit type argument's replaced with <>
1 parent 87bf4e4 commit 50c9ee7

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ public class ZulipApp extends Application {
6767
* Mapping of email address to presence information for that user. This is
6868
* updated every 2 minutes by a background thread (see AsyncStatusUpdate)
6969
*/
70-
public final Map<String, Presence> presences = new ConcurrentHashMap<String, Presence>();
70+
public final Map<String, Presence> presences = new ConcurrentHashMap<>();
7171

7272
/**
7373
* Queue of message ids to be marked as read. This queue should be emptied
7474
* every couple of seconds
7575
*/
76-
public final Queue<Integer> unreadMessageQueue = new ConcurrentLinkedQueue<Integer>();
76+
public final Queue<Integer> unreadMessageQueue = new ConcurrentLinkedQueue<>();
7777

7878
public static ZulipApp get() {
7979
return instance;
@@ -104,7 +104,7 @@ public void onCreate() {
104104
afterLogin();
105105
}
106106

107-
mutedTopics = new HashSet<String>(settings.getStringSet(MUTED_TOPIC_KEY, new HashSet<String>()));
107+
mutedTopics = new HashSet<>(settings.getStringSet(MUTED_TOPIC_KEY, new HashSet<String>()));
108108
// create unread message queue
109109
unreadMessageHandler = new Handler(new Handler.Callback() {
110110
@Override
@@ -205,7 +205,7 @@ public void addToMutedTopics(JSONArray jsonArray) {
205205
}
206206
}
207207
SharedPreferences.Editor editor = settings.edit();
208-
editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics));
208+
editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<>(mutedTopics));
209209
editor.apply();
210210
}
211211

@@ -254,7 +254,7 @@ public DatabaseHelper getDatabaseHelper() {
254254
@SuppressWarnings("unchecked")
255255
public <C, T> RuntimeExceptionDao<C, T> getDao(Class<C> cls) {
256256
try {
257-
return new RuntimeExceptionDao<C, T>(
257+
return new RuntimeExceptionDao<>(
258258
(Dao<C, T>) databaseHelper.getDao(cls));
259259
} catch (SQLException e) {
260260
// Well that's sort of awkward.
@@ -338,7 +338,7 @@ public void markMessageAsRead(Message message) {
338338
public void muteTopic(Message message) {
339339
mutedTopics.add(message.concatStreamAndTopic());
340340
SharedPreferences.Editor editor = settings.edit();
341-
editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics));
341+
editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<>(mutedTopics));
342342
editor.apply();
343343
}
344344

app/src/main/java/com/zulip/android/activities/MessageListFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void onCreate(Bundle savedInstanceState) {
109109
filter = getArguments().getParcelable(PARAM_FILTER);
110110
}
111111
mutedMessages = new ArrayList<>();
112-
messageIndex = new SparseArray<Message>();
112+
messageIndex = new SparseArray<>();
113113
messageList = new ArrayList<>();
114114
}
115115

app/src/main/java/com/zulip/android/filters/NarrowFilterPM.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public NarrowFilterPM(List<Person> people) {
4242

4343
private NarrowFilterPM(String recipientString) {
4444
this.recipientString = recipientString;
45-
this.people = new ArrayList<Person>();
45+
this.people = new ArrayList<>();
4646
for (String id : this.recipientString.split(",")) {
4747
this.people
4848
.add(Person.getById(ZulipApp.get(), Integer.valueOf(id)));
@@ -72,7 +72,7 @@ public boolean matches(Message msg) {
7272

7373
@Override
7474
public String getTitle() {
75-
ArrayList<String> names = new ArrayList<String>();
75+
ArrayList<String> names = new ArrayList<>();
7676
for (Person person : people) {
7777
if (!person.equals(ZulipApp.get().getYou())) {
7878
names.add(person.getName());
@@ -98,7 +98,7 @@ public String getComposePMRecipient() {
9898

9999
@Override
100100
public String getJsonFilter() throws JSONException {
101-
ArrayList<String> emails = new ArrayList<String>();
101+
ArrayList<String> emails = new ArrayList<>();
102102
for (Person person : this.people) {
103103
if (!person.equals(ZulipApp.get().getYou())) {
104104
emails.add(person.getEmail());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public String getDisplayRecipient(ZulipApp app) {
240240
return this.getStream().getName();
241241
} else {
242242
Person[] people = this.getRecipients(app);
243-
ArrayList<String> names = new ArrayList<String>();
243+
ArrayList<String> names = new ArrayList<>();
244244

245245
for (Person person : people) {
246246
if (person.id != app.getYou().id) {
@@ -268,7 +268,7 @@ public String getReplyTo(ZulipApp app) {
268268
}
269269

270270
public static String emailsMinusYou(List<Person> people, Person you) {
271-
ArrayList<String> names = new ArrayList<String>();
271+
ArrayList<String> names = new ArrayList<>();
272272

273273
for (Person person : people) {
274274
if (person.id != you.id) {
@@ -286,7 +286,7 @@ public static String emailsMinusYou(List<Person> people, Person you) {
286286
*/
287287
public Person[] getPersonalReplyTo(ZulipApp app) {
288288
Person[] people = this.getRecipients(app);
289-
ArrayList<Person> names = new ArrayList<Person>();
289+
ArrayList<Person> names = new ArrayList<>();
290290

291291
for (Person person : people) {
292292
if (person.id != app.getYou().id) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static Person getById(ZulipApp app, int id) {
207207
}
208208

209209
public static void sortByPresence(ZulipApp app, List<Person> people) {
210-
final Map<String, Presence> presenceCopy = new HashMap<String, Presence>(
210+
final Map<String, Presence> presenceCopy = new HashMap<>(
211211
app.presences);
212212

213213
Collections.sort(people, new Comparator<Person>() {

app/src/main/java/com/zulip/android/networking/AsyncGetEvents.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ private void processEvents(JSONArray events) {
257257
StopWatch watch = new StopWatch();
258258
watch.start();
259259

260-
ArrayList<Message> messages = new ArrayList<Message>();
261-
HashMap<String, Person> personCache = new HashMap<String, Person>();
262-
HashMap<String, Stream> streamCache = new HashMap<String, Stream>();
260+
ArrayList<Message> messages = new ArrayList<>();
261+
HashMap<String, Person> personCache = new HashMap<>();
262+
HashMap<String, Stream> streamCache = new HashMap<>();
263263

264264
for (int i = 0; i < events.length(); i++) {
265265
JSONObject event = events.getJSONObject(i);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public final void execute(int anchor, LoadPosition pos, int before,
6464
this.after = after;
6565
this.filter = filter;
6666
position = pos;
67-
this.receivedMessages = new ArrayList<Message>();
67+
this.receivedMessages = new ArrayList<>();
6868
Log.i("AGOM", "executing " + anchor + " " + before + " " + after);
6969
execute("GET", "v1/messages");
7070
}
@@ -236,11 +236,11 @@ protected boolean fetchMessages(int anchor, int numBefore, int numAfter,
236236
watch.reset();
237237
watch.start();
238238
JSONArray objects = response.getJSONArray("messages");
239-
ArrayList<Message> fetchedMessages = new ArrayList<Message>(
239+
ArrayList<Message> fetchedMessages = new ArrayList<>(
240240
objects.length());
241241

242-
HashMap<String, Person> personCache = new HashMap<String, Person>();
243-
HashMap<String, Stream> streamCache = new HashMap<String, Stream>();
242+
HashMap<String, Person> personCache = new HashMap<>();
243+
HashMap<String, Stream> streamCache = new HashMap<>();
244244

245245
for (int i = 0; i < objects.length(); i++) {
246246
Message message = new Message(this.app,

app/src/main/java/com/zulip/android/networking/AsyncUnreadMessagesUpdate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public AsyncUnreadMessagesUpdate(ZulipApp app) {
1414
}
1515

1616
public final void execute() {
17-
ArrayList<Integer> messageIds = new ArrayList<Integer>();
17+
ArrayList<Integer> messageIds = new ArrayList<>();
1818
while (true) {
1919
Integer item = app.unreadMessageQueue.poll();
2020
if (item == null) {

app/src/main/java/com/zulip/android/networking/GravatarAsyncFetchTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class GravatarAsyncFetchTask extends AsyncTask<URL, Void, Bitmap> {
3636
private GravatarAsyncFetchTask(ZulipActivity context, ImageView imageView,
3737
Person person) {
3838
// Use a WeakReference to ensure the ImageView can be garbage collected
39-
imageViewReference = new WeakReference<ImageView>(imageView);
39+
imageViewReference = new WeakReference<>(imageView);
4040
this.person = person;
4141
this.context = context;
4242
}
@@ -106,7 +106,7 @@ static class AsyncDrawable extends BitmapDrawable {
106106
public AsyncDrawable(Resources res, Bitmap bitmap,
107107
GravatarAsyncFetchTask bitmapWorkerTask) {
108108
super(res, bitmap);
109-
taskReference = new WeakReference<GravatarAsyncFetchTask>(
109+
taskReference = new WeakReference<>(
110110
bitmapWorkerTask);
111111
}
112112

app/src/main/java/com/zulip/android/util/CustomHtmlToSpannedConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public Header(int level) {
602602
}
603603

604604
private static HashMap<String, Integer> buildColorMap() {
605-
HashMap<String, Integer> map = new HashMap<String, Integer>();
605+
HashMap<String, Integer> map = new HashMap<>();
606606
map.put("aqua", 0x00FFFF);
607607
map.put("black", 0x000000);
608608
map.put("blue", 0x0000FF);

0 commit comments

Comments
 (0)