Bug 956360 - Use Arrays.asList when possible. r=jchen
This commit is contained in:
@@ -16,6 +16,7 @@ import java.net.URL;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -678,10 +679,7 @@ public abstract class GeckoApp
|
|||||||
Intent intent = GeckoAppShell.getOpenURIIntent(sAppContext, message.optString("url"),
|
Intent intent = GeckoAppShell.getOpenURIIntent(sAppContext, message.optString("url"),
|
||||||
message.optString("mime"), message.optString("action"), message.optString("title"));
|
message.optString("mime"), message.optString("action"), message.optString("title"));
|
||||||
String[] handlers = GeckoAppShell.getHandlersForIntent(intent);
|
String[] handlers = GeckoAppShell.getHandlersForIntent(intent);
|
||||||
ArrayList<String> appList = new ArrayList<String>(handlers.length);
|
List<String> appList = Arrays.asList(handlers);
|
||||||
for (int i = 0; i < handlers.length; i++) {
|
|
||||||
appList.add(handlers[i]);
|
|
||||||
}
|
|
||||||
JSONObject handlersJSON = new JSONObject();
|
JSONObject handlersJSON = new JSONObject();
|
||||||
handlersJSON.put("apps", new JSONArray(appList));
|
handlersJSON.put("apps", new JSONArray(appList));
|
||||||
EventDispatcher.sendResponse(message, handlersJSON);
|
EventDispatcher.sendResponse(message, handlersJSON);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.net.URI;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.mozilla.gecko.background.common.log.Logger;
|
import org.mozilla.gecko.background.common.log.Logger;
|
||||||
@@ -118,9 +119,9 @@ public class BrowserIDRemoteVerifierClient implements BrowserIDVerifierClient {
|
|||||||
|
|
||||||
r.delegate = new RemoteVerifierResourceDelegate(r, delegate);
|
r.delegate = new RemoteVerifierResourceDelegate(r, delegate);
|
||||||
|
|
||||||
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
|
List<NameValuePair> nvps = Arrays.asList(new NameValuePair[] {
|
||||||
nvps.add(new BasicNameValuePair("audience", audience));
|
new BasicNameValuePair("audience", audience),
|
||||||
nvps.add(new BasicNameValuePair("assertion", assertion));
|
new BasicNameValuePair("assertion", assertion) });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
r.post(new UrlEncodedFormEntity(nvps, "UTF-8"));
|
r.post(new UrlEncodedFormEntity(nvps, "UTF-8"));
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ import java.io.File;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Favicons {
|
public class Favicons {
|
||||||
@@ -396,9 +398,9 @@ public class Favicons {
|
|||||||
|
|
||||||
// Load and cache the built-in favicon in each of its sizes.
|
// Load and cache the built-in favicon in each of its sizes.
|
||||||
// TODO: don't open the zip twice!
|
// TODO: don't open the zip twice!
|
||||||
ArrayList<Bitmap> toInsert = new ArrayList<Bitmap>(2);
|
List<Bitmap> toInsert = Arrays.asList(loadBrandingBitmap(context, "favicon64.png"),
|
||||||
toInsert.add(loadBrandingBitmap(context, "favicon64.png"));
|
loadBrandingBitmap(context, "favicon32.png"));
|
||||||
toInsert.add(loadBrandingBitmap(context, "favicon32.png"));
|
|
||||||
putFaviconsInMemCache(BUILT_IN_FAVICON_URL, toInsert.iterator(), true);
|
putFaviconsInMemCache(BUILT_IN_FAVICON_URL, toInsert.iterator(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -789,9 +790,9 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
|
|||||||
new MeasurementFields() {
|
new MeasurementFields() {
|
||||||
@Override
|
@Override
|
||||||
public Iterable<FieldSpec> getFields() {
|
public Iterable<FieldSpec> getFields() {
|
||||||
ArrayList<FieldSpec> out = new ArrayList<FieldSpec>(2);
|
List<FieldSpec> out = Arrays.asList(
|
||||||
out.add(new FieldSpec("normal", Field.TYPE_JSON_DISCRETE));
|
new FieldSpec("normal", Field.TYPE_JSON_DISCRETE),
|
||||||
out.add(new FieldSpec("abnormal", Field.TYPE_JSON_DISCRETE));
|
new FieldSpec("abnormal", Field.TYPE_JSON_DISCRETE));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import android.util.Log;
|
|||||||
import org.mozilla.gecko.mozglue.RobocopTarget;
|
import org.mozilla.gecko.mozglue.RobocopTarget;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -200,9 +201,7 @@ public class SQLiteBridge {
|
|||||||
if (!TextUtils.isEmpty(whereClause)) {
|
if (!TextUtils.isEmpty(whereClause)) {
|
||||||
sb.append(" WHERE ");
|
sb.append(" WHERE ");
|
||||||
sb.append(whereClause);
|
sb.append(whereClause);
|
||||||
for (int i = 0; i < whereArgs.length; i++) {
|
valueNames.addAll(Arrays.asList(whereArgs));
|
||||||
valueNames.add(whereArgs[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] binds = new String[valueNames.size()];
|
String[] binds = new String[valueNames.size()];
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
package org.mozilla.gecko.sync.repositories.android;
|
package org.mozilla.gecko.sync.repositories.android;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -313,9 +314,9 @@ public class FormHistoryRepositorySession extends
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ArrayList<Callable<Cursor>> callableCursors = new ArrayList<Callable<Cursor>>();
|
@SuppressWarnings("unchecked")
|
||||||
callableCursors.add(regularCallable);
|
List<Callable<Cursor>> callableCursors = Arrays.asList(regularCallable, deletedCallable);
|
||||||
callableCursors.add(deletedCallable);
|
|
||||||
fetchHelper(delegate, sharedEnd, callableCursors);
|
fetchHelper(delegate, sharedEnd, callableCursors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,9 +349,9 @@ public class FormHistoryRepositorySession extends
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ArrayList<Callable<Cursor>> callableCursors = new ArrayList<Callable<Cursor>>();
|
@SuppressWarnings("unchecked")
|
||||||
callableCursors.add(regularCallable);
|
List<Callable<Cursor>> callableCursors = Arrays.asList(regularCallable, deletedCallable);
|
||||||
callableCursors.add(deletedCallable);
|
|
||||||
fetchHelper(delegate, sharedEnd, callableCursors);
|
fetchHelper(delegate, sharedEnd, callableCursors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
package org.mozilla.gecko.sync.setup.activities;
|
package org.mozilla.gecko.sync.setup.activities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -50,10 +51,7 @@ public class SendTabData {
|
|||||||
|
|
||||||
// For URL, take first URL from EXTRA_TEXT, EXTRA_SUBJECT, and EXTRA_TITLE
|
// For URL, take first URL from EXTRA_TEXT, EXTRA_SUBJECT, and EXTRA_TITLE
|
||||||
// (in that order).
|
// (in that order).
|
||||||
List<String> strings = new ArrayList<String>();
|
List<String> strings = Arrays.asList(text, subject, title);
|
||||||
strings.add(text);
|
|
||||||
strings.add(subject);
|
|
||||||
strings.add(title);
|
|
||||||
String theUri = new WebURLFinder(strings).bestWebURL();
|
String theUri = new WebURLFinder(strings).bestWebURL();
|
||||||
|
|
||||||
return new SendTabData(theTitle, theUri);
|
return new SendTabData(theTitle, theUri);
|
||||||
|
|||||||
Reference in New Issue
Block a user