Merge pull request #3720 from ByteHamster/do-not-allocate-arrays

Do not allocate space for arrays that do not need to be allocated
This commit is contained in:
H. Lehmann 2020-01-09 17:28:12 +01:00 committed by GitHub
commit 6d0b16461d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View File

@ -201,7 +201,7 @@ public class UITestUtils {
PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
adapter.setCompleteFeed(hostedFeeds.toArray(new Feed[hostedFeeds.size()]));
adapter.setCompleteFeed(hostedFeeds.toArray(new Feed[0]));
adapter.setQueue(queue);
adapter.close();
EventBus.getDefault().post(new FeedListUpdateEvent(hostedFeeds));

View File

@ -485,7 +485,7 @@ public class EpisodesApplyActionFragment extends Fragment {
}
}
try {
DownloadRequester.getInstance().downloadMedia(getActivity(), toDownload.toArray(new FeedItem[toDownload.size()]));
DownloadRequester.getInstance().downloadMedia(getActivity(), toDownload.toArray(new FeedItem[0]));
} catch (DownloadRequestException e) {
e.printStackTrace();
DownloadRequestErrorDialogCreator.newRequestErrorDialog(getActivity(), e.getMessage());

View File

@ -131,9 +131,7 @@ public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
prefValuesList.add(key);
}
UserPreferences.setAutodownloadSelectedNetworks(
prefValuesList.toArray(new String[prefValuesList.size()])
);
UserPreferences.setAutodownloadSelectedNetworks(prefValuesList.toArray(new String[0]));
return true;
} else {
return false;

View File

@ -108,7 +108,7 @@ public class FeedMenuHandler {
FilterDialog filterDialog = new FilterDialog(context, selectedFeed.getItemFilter()) {
@Override
protected void updateFilter(Set<String> filterValues) {
selectedFeed.setItemFilter(filterValues.toArray(new String[filterValues.size()]));
selectedFeed.setItemFilter(filterValues.toArray(new String[0]));
DBWriter.setFeedItemsFilter(selectedFeed.getId(), filterValues);
}
};