Remove unnecessary "new Type[]" when declaring arrays

This commit is contained in:
Daniel Martí 2015-03-31 02:21:32 +02:00
parent 0fde562b32
commit 713e33bf57
8 changed files with 11 additions and 11 deletions

View File

@ -541,7 +541,7 @@ public class UpdateService extends IntentService implements ProgressListener {
private List<String> getKnownAppIdsFromProvider(List<App> apps) {
final Uri uri = AppProvider.getContentUri(apps);
String[] fields = new String[] { AppProvider.DataColumns.APP_ID };
String[] fields = { AppProvider.DataColumns.APP_ID };
Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
int knownIdCount = cursor != null ? cursor.getCount() : 0;

View File

@ -301,13 +301,13 @@ public class ApkProvider extends FDroidProvider {
private QuerySelection queryApp(String appId) {
String selection = DataColumns.APK_ID + " = ? ";
String[] args = new String[] { appId };
String[] args = { appId };
return new QuerySelection(selection, args);
}
private QuerySelection querySingle(Uri uri) {
String selection = " vercode = ? and id = ? ";
String[] args = new String[] {
String[] args = {
// First (0th) path segment is the word "apk",
// and we are not interested in it.
uri.getPathSegments().get(1),
@ -318,7 +318,7 @@ public class ApkProvider extends FDroidProvider {
private QuerySelection queryRepo(long repoId) {
String selection = DataColumns.REPO_ID + " = ? ";
String[] args = new String[]{ Long.toString(repoId) };
String[] args = { Long.toString(repoId) };
return new QuerySelection(selection, args);
}

View File

@ -21,7 +21,7 @@ public class AppProvider extends FDroidProvider {
private Helper() {}
public static int count(Context context, Uri uri) {
String[] projection = new String[] { AppProvider.DataColumns._COUNT };
String[] projection = { AppProvider.DataColumns._COUNT };
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
int count = 0;
if (cursor != null && cursor.getCount() == 1) {

View File

@ -72,11 +72,11 @@ public class SystemInstaller extends Installer {
mDeleteObserver = new PackageDeleteObserver();
try {
Class<?>[] installTypes = new Class[] {
Class<?>[] installTypes = {
Uri.class, IPackageInstallObserver.class, int.class,
String.class
};
Class<?>[] deleteTypes = new Class[] {
Class<?>[] deleteTypes = {
String.class, IPackageDeleteObserver.class,
int.class
};

View File

@ -271,7 +271,7 @@ public class LocalRepoKeyStore {
private void addToStore(String alias, KeyPair kp, Certificate cert) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException,
UnrecoverableKeyException {
Certificate[] chain = new Certificate[] {
Certificate[] chain = {
cert
};
keyStore.setKeyEntry(alias, kp.getPrivate(),

View File

@ -94,7 +94,7 @@ public class MDnsHelper implements ServiceListener {
protected Void doInBackground(Void... params) {
try {
int ip = wifiManager.getConnectionInfo().getIpAddress();
byte[] byteIp = new byte[] {
byte[] byteIp = {
(byte) (ip & 0xff),
(byte) (ip >> 8 & 0xff),
(byte) (ip >> 16 & 0xff),

View File

@ -613,7 +613,7 @@ public class ManageReposActivity extends ActionBarActivity {
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
Uri uri = RepoProvider.getContentUri();
Log.i(TAG, "Creating repo loader '" + uri + "'.");
String[] projection = new String[] {
String[] projection = {
RepoProvider.DataColumns._ID,
RepoProvider.DataColumns.NAME,
RepoProvider.DataColumns.PUBLIC_KEY,

View File

@ -53,7 +53,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
.commit();
}
String[] projection = new String[] {
String[] projection = {
RepoProvider.DataColumns.NAME,
RepoProvider.DataColumns.ADDRESS,
RepoProvider.DataColumns.FINGERPRINT