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) { private List<String> getKnownAppIdsFromProvider(List<App> apps) {
final Uri uri = AppProvider.getContentUri(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); Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
int knownIdCount = cursor != null ? cursor.getCount() : 0; int knownIdCount = cursor != null ? cursor.getCount() : 0;

View File

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

View File

@ -21,7 +21,7 @@ public class AppProvider extends FDroidProvider {
private Helper() {} private Helper() {}
public static int count(Context context, Uri uri) { 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); Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
int count = 0; int count = 0;
if (cursor != null && cursor.getCount() == 1) { if (cursor != null && cursor.getCount() == 1) {

View File

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

View File

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

View File

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

View File

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

View File

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