Don't use ArrayList over List unless necessary

This commit is contained in:
Daniel Martí 2015-03-30 21:07:26 +02:00
parent e1df9c600c
commit ac820baf72
2 changed files with 7 additions and 6 deletions

View File

@ -171,7 +171,7 @@ public class UpdateService extends IntentService implements ProgressListener {
finished = true;
} else if (resultCode == UpdateService.STATUS_ERROR_LOCAL || resultCode == UpdateService.STATUS_ERROR_LOCAL_SMALL) {
StringBuilder msgB = new StringBuilder();
ArrayList<CharSequence> repoErrors = resultData.getCharSequenceArrayList(UpdateService.RESULT_REPO_ERRORS);
List<CharSequence> repoErrors = resultData.getCharSequenceArrayList(UpdateService.RESULT_REPO_ERRORS);
for (CharSequence error : repoErrors) {
if (msgB.length() > 0) msgB.append('\n');
msgB.append(error);
@ -351,7 +351,7 @@ public class UpdateService extends IntentService implements ProgressListener {
List<Repo> unchangedRepos = new ArrayList<Repo>();
List<Repo> updatedRepos = new ArrayList<Repo>();
List<Repo> disabledRepos = new ArrayList<Repo>();
ArrayList<CharSequence> errorRepos = new ArrayList<CharSequence>();
List<CharSequence> errorRepos = new ArrayList<CharSequence>();
ArrayList<CharSequence> repoErrors = new ArrayList<CharSequence>();
List<RepoUpdater.RepoUpdateRememberer> repoUpdateRememberers = new ArrayList<RepoUpdater.RepoUpdateRememberer>();
boolean changes = false;
@ -579,7 +579,7 @@ public class UpdateService extends IntentService implements ProgressListener {
private void updateOrInsertApps(List<App> appsToUpdate, int totalUpdateCount, int currentCount) {
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
List<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
List<String> knownAppIds = getKnownAppIds(appsToUpdate);
for (final App a : appsToUpdate) {
boolean known = false;
@ -608,7 +608,7 @@ public class UpdateService extends IntentService implements ProgressListener {
}
private void executeBatchWithStatus(String providerAuthority,
ArrayList<ContentProviderOperation> operations,
List<ContentProviderOperation> operations,
int currentCount,
int totalUpdateCount)
throws RemoteException, OperationApplicationException {
@ -643,7 +643,7 @@ public class UpdateService extends IntentService implements ProgressListener {
private void updateOrInsertApks(List<Apk> apksToUpdate, int totalApksAppsCount, int currentCount) {
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
List<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
List<Apk> knownApks = getKnownApks(apksToUpdate);
for (final Apk apk : apksToUpdate) {

View File

@ -42,6 +42,7 @@ import org.fdroid.fdroid.localrepo.LocalRepoManager;
import org.fdroid.fdroid.views.SelectLocalAppsActivity;
import java.util.HashSet;
import java.util.Set;
public class SelectLocalAppsFragment extends ListFragment
implements LoaderManager.LoaderCallbacks<Cursor>, OnQueryTextListener {
@ -112,7 +113,7 @@ public class SelectLocalAppsFragment extends ListFragment
// build list of existing apps from what is on the file system
if (FDroidApp.selectedApps == null) {
HashSet<String> selectedApps = new HashSet<String>();
Set<String> selectedApps = new HashSet<String>();
for (String filename : LocalRepoManager.get(selectLocalAppsActivity).repoDir.list()) {
if (filename.matches(".*\\.apk")) {
String packageName = filename.substring(0, filename.indexOf("_"));