Performance: 'Collection.toArray()' call style

This commit is contained in:
TacoTheDank 2020-11-19 15:17:52 -05:00
parent 830a227507
commit 270e7e873d
43 changed files with 69 additions and 69 deletions

View file

@ -800,7 +800,7 @@ public abstract class ByteString implements Iterable<Byte> {
// Copy the information we need into local variables so as to hold // Copy the information we need into local variables so as to hold
// the lock for as short a time as possible. // the lock for as short a time as possible.
cachedFlushBuffers = cachedFlushBuffers =
flushedBuffers.toArray(new ByteString[flushedBuffers.size()]); flushedBuffers.toArray(new ByteString[0]);
cachedBuffer = buffer; cachedBuffer = buffer;
cachedBufferPos = bufferPos; cachedBufferPos = bufferPos;
} }

View file

@ -322,7 +322,7 @@ public final class MvtReader {
geoms.add(geomFactory.createLineString(nextCoordSeq)); geoms.add(geomFactory.createLineString(nextCoordSeq));
} }
return geoms.size() == 1 ? geoms.get(0) : geomFactory.createMultiLineString(geoms.toArray(new LineString[geoms.size()])); return geoms.size() == 1 ? geoms.get(0) : geomFactory.createMultiLineString(geoms.toArray(new LineString[0]));
} }
/** /**
@ -450,7 +450,7 @@ public final class MvtReader {
return polygons.get(0); return polygons.get(0);
} else { } else {
return geomFactory.createMultiPolygon(polygons.toArray(new Polygon[polygons.size()])); return geomFactory.createMultiPolygon(polygons.toArray(new Polygon[0]));
} }
} }
@ -512,7 +512,7 @@ public final class MvtReader {
if (area > 0d) { if (area > 0d) {
if (outerPoly != null) { if (outerPoly != null) {
polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[holes.size()]))); polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[0])));
holes.clear(); holes.clear();
} }
@ -533,7 +533,7 @@ public final class MvtReader {
if (outerPoly != null) { if (outerPoly != null) {
holes.toArray(); holes.toArray();
polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[holes.size()]))); polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[0])));
} }
return polygons; return polygons;
@ -569,7 +569,7 @@ public final class MvtReader {
if (outerPoly == null || (outerArea < 0 == area < 0)) { if (outerPoly == null || (outerArea < 0 == area < 0)) {
if (outerPoly != null) { if (outerPoly != null) {
polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[holes.size()]))); polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[0])));
holes.clear(); holes.clear();
} }
@ -590,7 +590,7 @@ public final class MvtReader {
if (outerPoly != null) { if (outerPoly != null) {
holes.toArray(); holes.toArray();
polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[holes.size()]))); polygons.add(geomFactory.createPolygon(outerPoly, holes.toArray(new LinearRing[0])));
} }
return polygons; return polygons;

View file

@ -1247,7 +1247,7 @@ public class GPXUtilities {
} }
} }
} }
g.prepareInformation(fileTimestamp, splitSegments.toArray(new SplitSegment[splitSegments.size()])); g.prepareInformation(fileTimestamp, splitSegments.toArray(new SplitSegment[0]));
return g; return g;
} }

View file

@ -61,9 +61,9 @@ public class Multipolygon {
innerLinearRings.add(innerRing.toLinearRing()); innerLinearRings.add(innerRing.toLinearRing());
} }
} }
polygons.add(geometryFactory.createPolygon(outerRing.toLinearRing(), innerLinearRings.toArray(new LinearRing[innerLinearRings.size()]))); polygons.add(geometryFactory.createPolygon(outerRing.toLinearRing(), innerLinearRings.toArray(new LinearRing[0])));
} }
return geometryFactory.createMultiPolygon(polygons.toArray(new Polygon[polygons.size()])); return geometryFactory.createMultiPolygon(polygons.toArray(new Polygon[0]));
} }
public long getId() { public long getId() {

View file

@ -140,7 +140,7 @@ public class TileSourceManager {
} }
} }
} }
return randoms.toArray(new String[randoms.size()]); return randoms.toArray(new String[0]);
} }
public void setMinZoom(int minZoom) { public void setMinZoom(int minZoom) {

View file

@ -70,7 +70,7 @@ public class RenderingRule {
i++; i++;
} }
} }
properties = props.toArray(new RenderingRuleProperty[props.size()]); properties = props.toArray(new RenderingRuleProperty[0]);
} }
private int getPropertyIndex(String property){ private int getPropertyIndex(String property){

View file

@ -318,7 +318,7 @@ public class RenderingRuleStorageProperties {
} }
public RenderingRuleProperty[] getPoperties() { public RenderingRuleProperty[] getPoperties() {
return rules.toArray(new RenderingRuleProperty[rules.size()]); return rules.toArray(new RenderingRuleProperty[0]);
} }
public List<RenderingRuleProperty> getCustomRules() { public List<RenderingRuleProperty> getCustomRules() {

View file

@ -492,10 +492,10 @@ public class RenderingRulesStorage {
} }
public String[] getRenderingAttributeNames() { public String[] getRenderingAttributeNames() {
return renderingAttributes.keySet().toArray(new String[renderingAttributes.size()]); return renderingAttributes.keySet().toArray(new String[0]);
} }
public RenderingRule[] getRenderingAttributeValues() { public RenderingRule[] getRenderingAttributeValues() {
return renderingAttributes.values().toArray(new RenderingRule[renderingAttributes.size()]); return renderingAttributes.values().toArray(new RenderingRule[0]);
} }
public RenderingRule[] getRules(int state){ public RenderingRule[] getRules(int state){

View file

@ -754,21 +754,21 @@ public class GeneralRouter implements VehicleRouter {
} }
public RouteAttributeEvalRule[] getRules() { public RouteAttributeEvalRule[] getRules() {
return rules.toArray(new RouteAttributeEvalRule[rules.size()]); return rules.toArray(new RouteAttributeEvalRule[0]);
} }
public String[] getParamKeys() { public String[] getParamKeys() {
if(paramContext == null) { if(paramContext == null) {
return new String[0]; return new String[0];
} }
return paramContext.vars.keySet().toArray(new String[paramContext.vars.size()]); return paramContext.vars.keySet().toArray(new String[0]);
} }
public String[] getParamValues() { public String[] getParamValues() {
if(paramContext == null) { if(paramContext == null) {
return new String[0]; return new String[0];
} }
return paramContext.vars.values().toArray(new String[paramContext.vars.size()]); return paramContext.vars.values().toArray(new String[0]);
} }
private Object evaluate(RouteDataObject ro) { private Object evaluate(RouteDataObject ro) {
@ -988,19 +988,19 @@ public class GeneralRouter implements VehicleRouter {
public RouteAttributeExpression[] getExpressions() { public RouteAttributeExpression[] getExpressions() {
return expressions.toArray(new RouteAttributeExpression[expressions.size()]); return expressions.toArray(new RouteAttributeExpression[0]);
} }
public String[] getParameters() { public String[] getParameters() {
return parameters.toArray(new String[parameters.size()]); return parameters.toArray(new String[0]);
} }
public String[] getTagValueCondDefTag() { public String[] getTagValueCondDefTag() {
return tagValueCondDefTag.toArray(new String[tagValueCondDefTag.size()]); return tagValueCondDefTag.toArray(new String[0]);
} }
public String[] getTagValueCondDefValue() { public String[] getTagValueCondDefValue() {
return tagValueCondDefValue.toArray(new String[tagValueCondDefValue.size()]); return tagValueCondDefValue.toArray(new String[0]);
} }
public boolean[] getTagValueCondDefNot() { public boolean[] getTagValueCondDefNot() {

View file

@ -918,7 +918,7 @@ public class RoutePlannerFrontEnd {
private List<RouteSegmentResult> runNativeRouting(final RoutingContext ctx, RouteSegment recalculationEnd) throws IOException { private List<RouteSegmentResult> runNativeRouting(final RoutingContext ctx, RouteSegment recalculationEnd) throws IOException {
refreshProgressDistance(ctx); refreshProgressDistance(ctx);
RouteRegion[] regions = ctx.reverseMap.keySet().toArray(new BinaryMapRouteReaderAdapter.RouteRegion[ctx.reverseMap.size()]); RouteRegion[] regions = ctx.reverseMap.keySet().toArray(new RouteRegion[0]);
ctx.checkOldRoutingFiles(ctx.startX, ctx.startY); ctx.checkOldRoutingFiles(ctx.startX, ctx.startY);
ctx.checkOldRoutingFiles(ctx.targetX, ctx.targetY); ctx.checkOldRoutingFiles(ctx.targetX, ctx.targetY);

View file

@ -1717,7 +1717,7 @@ public class RouteResultPreparation {
} }
} }
} }
Integer[] array = possibleTurns.toArray(new Integer[possibleTurns.size()]); Integer[] array = possibleTurns.toArray(new Integer[0]);
Arrays.sort(array, new Comparator<Integer>() { Arrays.sort(array, new Comparator<Integer>() {
@Override @Override

View file

@ -802,7 +802,7 @@ public class RoutingContext {
} }
public BinaryMapIndexReader[] getMaps() { public BinaryMapIndexReader[] getMaps() {
return map.keySet().toArray(new BinaryMapIndexReader[map.size()]); return map.keySet().toArray(new BinaryMapIndexReader[0]);
} }
public int getVisitedSegments() { public int getVisitedSegments() {

View file

@ -373,7 +373,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
dialog.cancel(); dialog.cancel();
} }
}); });
info.setItems(attributes.toArray(new String[attributes.size()]), new DialogInterface.OnClickListener() { info.setItems(attributes.toArray(new String[0]), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
} }

View file

@ -208,7 +208,7 @@ public class ContextMenuAdapter {
} }
items.removeAll(itemsToRemove); items.removeAll(itemsToRemove);
return new ContextMenuArrayAdapter(activity, layoutId, R.id.title, return new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
items.toArray(new ContextMenuItem[items.size()]), app, lightTheme, changeAppModeListener); items.toArray(new ContextMenuItem[0]), app, lightTheme, changeAppModeListener);
} }
public class ContextMenuArrayAdapter extends ArrayAdapter<ContextMenuItem> { public class ContextMenuArrayAdapter extends ArrayAdapter<ContextMenuItem> {
@ -643,7 +643,7 @@ public class ContextMenuAdapter {
} }
public static OnItemDeleteAction makeDeleteAction(final List<? extends OsmandPreference> prefs) { public static OnItemDeleteAction makeDeleteAction(final List<? extends OsmandPreference> prefs) {
return makeDeleteAction(prefs.toArray(new OsmandPreference[prefs.size()])); return makeDeleteAction(prefs.toArray(new OsmandPreference[0]));
} }
private static void resetSetting(ApplicationMode appMode, OsmandPreference preference, boolean profileOnly) { private static void resetSetting(ApplicationMode appMode, OsmandPreference preference, boolean profileOnly) {

View file

@ -408,10 +408,10 @@ public class GpxSelectionHelper {
boolean split = true; boolean split = true;
if (group.splitDistance > 0) { if (group.splitDistance > 0) {
List<GPXTrackAnalysis> trackSegments = r.splitByDistance(group.splitDistance, joinSegments); List<GPXTrackAnalysis> trackSegments = r.splitByDistance(group.splitDistance, joinSegments);
as = trackSegments.toArray(new GPXTrackAnalysis[trackSegments.size()]); as = trackSegments.toArray(new GPXTrackAnalysis[0]);
} else if (group.splitTime > 0) { } else if (group.splitTime > 0) {
List<GPXTrackAnalysis> trackSegments = r.splitByTime(group.splitTime, joinSegments); List<GPXTrackAnalysis> trackSegments = r.splitByTime(group.splitTime, joinSegments);
as = trackSegments.toArray(new GPXTrackAnalysis[trackSegments.size()]); as = trackSegments.toArray(new GPXTrackAnalysis[0]);
} else { } else {
split = false; split = false;
as = new GPXTrackAnalysis[] {GPXTrackAnalysis.segment(0, r)}; as = new GPXTrackAnalysis[] {GPXTrackAnalysis.segment(0, r)};

View file

@ -1148,7 +1148,7 @@ public class MapActivityActions implements DialogProvider {
items.add(getString(R.string.show_location)); items.add(getString(R.string.show_location));
items.add(getString(R.string.shared_string_show_details)); items.add(getString(R.string.shared_string_show_details));
AlertDialog.Builder menu = new AlertDialog.Builder(mapActivity); AlertDialog.Builder menu = new AlertDialog.Builder(mapActivity);
menu.setItems(items.toArray(new String[items.size()]), new DialogInterface.OnClickListener() { menu.setItems(items.toArray(new String[0]), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int item) { public void onClick(DialogInterface dialog, int item) {
dialog.dismiss(); dialog.dismiss();

View file

@ -1860,7 +1860,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
protected Recording[] getRecordingsSorted() { protected Recording[] getRecordingsSorted() {
checkRecordings(); checkRecordings();
Collection<Recording> allObjects = getAllRecordings(); Collection<Recording> allObjects = getAllRecordings();
Recording[] res = allObjects.toArray(new Recording[allObjects.size()]); Recording[] res = allObjects.toArray(new Recording[0]);
Arrays.sort(res, new Comparator<Recording>() { Arrays.sort(res, new Comparator<Recording>() {
@Override @Override

View file

@ -223,7 +223,7 @@ public class DashChooseAppDirFragment {
paths.add(""); paths.add("");
types.add(OsmandSettings.EXTERNAL_STORAGE_TYPE_SPECIFIED); types.add(OsmandSettings.EXTERNAL_STORAGE_TYPE_SPECIFIED);
editalert.setSingleChoiceItems(items.toArray(new String[items.size()]), selected, editalert.setSingleChoiceItems(items.toArray(new String[0]), selected,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override

View file

@ -404,7 +404,7 @@ public class ConfigureMapMenu {
bld.setTitle(R.string.map_magnifier); bld.setTitle(R.string.map_magnifier);
bld.setNegativeButton(R.string.shared_string_dismiss, null); bld.setNegativeButton(R.string.shared_string_dismiss, null);
DialogListItemAdapter dialogAdapter = DialogListItemAdapter.createSingleChoiceAdapter( DialogListItemAdapter dialogAdapter = DialogListItemAdapter.createSingleChoiceAdapter(
values.toArray(new String[values.size()]), nightMode, i, app, selectedProfileColor, themeRes, new View.OnClickListener() { values.toArray(new String[0]), nightMode, i, app, selectedProfileColor, themeRes, new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int which = (int) v.getTag(); int which = (int) v.getTag();
@ -639,7 +639,7 @@ public class ConfigureMapMenu {
return mp.get(lhs).compareTo(mp.get(rhs)); return mp.get(lhs).compareTo(mp.get(rhs));
} }
}); });
return lst.toArray(new String[lst.size()]); return lst.toArray(new String[0]);
} }
public static String[] getMapNamesValues(Context ctx, String[] ids) { public static String[] getMapNamesValues(Context ctx, String[] ids) {

View file

@ -349,7 +349,7 @@ public class DownloadFileHelper {
private int currentRead = 0; private int currentRead = 0;
public CountingMultiInputStream(List<InputStream> streams) { public CountingMultiInputStream(List<InputStream> streams) {
this.delegate = streams.toArray(new InputStream[streams.size()]); this.delegate = streams.toArray(new InputStream[0]);
} }
@Override @Override

View file

@ -582,7 +582,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
operationTask = null; operationTask = null;
} }
if (operationTask != null) { if (operationTask != null) {
operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new LocalIndexInfo[selectedItems.size()])); operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new LocalIndexInfo[0]));
} }
if (actionMode != null) { if (actionMode != null) {
actionMode.finish(); actionMode.finish();

View file

@ -166,12 +166,12 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
dialog.setPositiveButton(R.string.shared_string_update, new DialogInterface.OnClickListener() { dialog.setPositiveButton(R.string.shared_string_update, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
getMyActivity().startDownload(indexItems.toArray(new IndexItem[indexItems.size()])); getMyActivity().startDownload(indexItems.toArray(new IndexItem[0]));
} }
}); });
dialog.create().show(); dialog.create().show();
} else { } else {
getMyActivity().startDownload(indexItems.toArray(new IndexItem[indexItems.size()])); getMyActivity().startDownload(indexItems.toArray(new IndexItem[0]));
} }
} }
}); });

View file

@ -871,7 +871,7 @@ public class ExternalApiHelper {
searchTypes.add(HOUSE); searchTypes.add(HOUSE);
searchTypes.add(STREET_INTERSECTION); searchTypes.add(STREET_INTERSECTION);
} }
searchSettings = searchSettings.setSearchTypes(searchTypes.toArray(new ObjectType[searchTypes.size()])); searchSettings = searchSettings.setSearchTypes(searchTypes.toArray(new ObjectType[0]));
core.search(searchQuery, false, null, searchSettings); core.search(searchQuery, false, null, searchSettings);
} }

View file

@ -277,7 +277,7 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
} }
} }
((ImageView) mainView.findViewById(R.id.action_bar_image)) ((ImageView) mainView.findViewById(R.id.action_bar_image))
.setImageDrawable(new LayerDrawable(imgList.toArray(new Drawable[imgList.size()]))); .setImageDrawable(new LayerDrawable(imgList.toArray(new Drawable[0])));
} else { } else {
mainView.findViewById(R.id.action_bar_image_container).setVisibility(View.GONE); mainView.findViewById(R.id.action_bar_image_container).setVisibility(View.GONE);
} }

View file

@ -73,7 +73,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
super(app); super(app);
liveMonitoringHelper = new LiveMonitoringHelper(app); liveMonitoringHelper = new LiveMonitoringHelper(app);
final List<ApplicationMode> am = ApplicationMode.allPossibleValues(); final List<ApplicationMode> am = ApplicationMode.allPossibleValues();
ApplicationMode.regWidgetVisibility("monitoring", am.toArray(new ApplicationMode[am.size()])); ApplicationMode.regWidgetVisibility("monitoring", am.toArray(new ApplicationMode[0]));
settings = app.getSettings(); settings = app.getSettings();
pluginPreferences.add(settings.SAVE_TRACK_TO_GPX); pluginPreferences.add(settings.SAVE_TRACK_TO_GPX);
pluginPreferences.add(settings.SAVE_TRACK_INTERVAL); pluginPreferences.add(settings.SAVE_TRACK_INTERVAL);

View file

@ -554,7 +554,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public void doAction(int actionResId) { public void doAction(int actionResId) {
if (actionResId == R.string.shared_string_delete) { if (actionResId == R.string.shared_string_delete) {
operationTask = new DeleteGpxTask(); operationTask = new DeleteGpxTask();
operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new GpxInfo[selectedItems.size()])); operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new GpxInfo[0]));
} else { } else {
operationTask = null; operationTask = null;
} }
@ -1009,7 +1009,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
List<GpxInfo> progress = new ArrayList<>(); List<GpxInfo> progress = new ArrayList<>();
loadGPXFolder(mapPath, result, loadTask, progress, ""); loadGPXFolder(mapPath, result, loadTask, progress, "");
if (!progress.isEmpty()) { if (!progress.isEmpty()) {
loadTask.loadFile(progress.toArray(new GpxInfo[progress.size()])); loadTask.loadFile(progress.toArray(new GpxInfo[0]));
} }
} }
} }
@ -1029,7 +1029,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
result.add(info); result.add(info);
progress.add(info); progress.add(info);
if (progress.size() > 7) { if (progress.size() > 7) {
loadTask.loadFile(progress.toArray(new GpxInfo[progress.size()])); loadTask.loadFile(progress.toArray(new GpxInfo[0]));
progress.clear(); progress.clear();
} }
} }
@ -1475,7 +1475,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
list.add(GPXDataSetType.SLOPE); list.add(GPXDataSetType.SLOPE);
} }
if (list.size() > 0) { if (list.size() > 0) {
gpxItem.chartTypes = list.toArray(new GPXDataSetType[list.size()]); gpxItem.chartTypes = list.toArray(new GPXDataSetType[0]);
} }
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(gpxItem.locationStart.lat, gpxItem.locationStart.lon, settings.setMapLocationToShow(gpxItem.locationStart.lat, gpxItem.locationStart.lon,

View file

@ -410,7 +410,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
tabTypeList.add(GPXTabItemType.GPX_TAB_ITEM_SPEED); tabTypeList.add(GPXTabItemType.GPX_TAB_ITEM_SPEED);
} }
} }
tabTypes = tabTypeList.toArray(new GPXTabItemType[tabTypeList.size()]); tabTypes = tabTypeList.toArray(new GPXTabItemType[0]);
Context context = tabs.getContext(); Context context = tabs.getContext();
titles = new String[tabTypes.length]; titles = new String[tabTypes.length];

View file

@ -222,8 +222,8 @@ public class AddPOIAction extends QuickAction {
} }
addPoiToStringSet(getPoiTypes(activity).getOtherMapCategory(), tagKeys, valueKeys); addPoiToStringSet(getPoiTypes(activity).getOtherMapCategory(), tagKeys, valueKeys);
tagKeys.addAll(EditPoiDialogFragment.BASIC_TAGS); tagKeys.addAll(EditPoiDialogFragment.BASIC_TAGS);
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()])); mAdapter.setTagData(tagKeys.toArray(new String[0]));
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()])); mAdapter.setValueData(valueKeys.toArray(new String[0]));
Button addTagButton = (Button) view.findViewById(R.id.addTagButton); Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
addTagButton.setOnClickListener(new View.OnClickListener() { addTagButton.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -89,8 +89,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
addPoiToStringSet(abstractPoiType, tagKeys, valueKeys); addPoiToStringSet(abstractPoiType, tagKeys, valueKeys);
} }
addPoiToStringSet(mapPoiTypes.getOtherMapCategory(), tagKeys, valueKeys); addPoiToStringSet(mapPoiTypes.getOtherMapCategory(), tagKeys, valueKeys);
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()])); mAdapter.setTagData(tagKeys.toArray(new String[0]));
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()])); mAdapter.setValueData(valueKeys.toArray(new String[0]));
Button addTagButton = (Button) view.findViewById(R.id.addTagButton); Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
addTagButton.setOnClickListener(new View.OnClickListener() { addTagButton.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -415,7 +415,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
List<GpxInfo> selectedItems = f.getSelectedItems(); List<GpxInfo> selectedItems = f.getSelectedItems();
sendGPXFiles(activity, f, sendGPXFiles(activity, f,
selectedItems.toArray(new GpxInfo[selectedItems.size()])); selectedItems.toArray(new GpxInfo[0]));
} }
}); });
return true; return true;

View file

@ -296,7 +296,7 @@ public class OsmEditsFragment extends OsmAndListFragment implements ProgressDial
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
uploadItems(osmEditsSelected.toArray(new OsmPoint[osmEditsSelected.size()])); uploadItems(osmEditsSelected.toArray(new OsmPoint[0]));
mode.finish(); mode.finish();
return true; return true;
} }
@ -594,7 +594,7 @@ public class OsmEditsFragment extends OsmAndListFragment implements ProgressDial
public void onClick(int type) { public void onClick(int type) {
List<OsmPoint> points = getPointsToExport(); List<OsmPoint> points = getPointsToExport();
new BackupOpenstreetmapPointAsyncTask(type, exportType).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new BackupOpenstreetmapPointAsyncTask(type, exportType).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
points.toArray(new OsmPoint[points.size()])); points.toArray(new OsmPoint[0]));
} }
}; };
} }

View file

@ -221,7 +221,7 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener {
new UploadingMultipleErrorDialogFragment(); new UploadingMultipleErrorDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable(POINTS_WITH_ERRORS, bundle.putSerializable(POINTS_WITH_ERRORS,
pointsWithErrors.toArray(new OsmPoint[pointsWithErrors.size()])); pointsWithErrors.toArray(new OsmPoint[0]));
bundle.putStringArray(POINT_NAMES, pointNames); bundle.putStringArray(POINT_NAMES, pointNames);
bundle.putBooleanArray(HAS_ERROR, hasErrors); bundle.putBooleanArray(HAS_ERROR, hasErrors);
fragment.setArguments(bundle); fragment.setArguments(bundle);

View file

@ -36,7 +36,7 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
} else { } else {
addCategory(a, strings); addCategory(a, strings);
} }
final String[] subCats = strings.toArray(new String[strings.size()]); final String[] subCats = strings.toArray(new String[0]);
builder.setItems(subCats, new DialogInterface.OnClickListener() { builder.setItems(subCats, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {

View file

@ -31,7 +31,7 @@ public class PoiTypeDialogFragment extends DialogFragment {
categories.add(category); categories.add(category);
} }
} }
builder.setItems(vals.toArray(new String[vals.size()]), new Dialog.OnClickListener() { builder.setItems(vals.toArray(new String[0]), new Dialog.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
PoiCategory aType = categories.get(which); PoiCategory aType = categories.get(which);

View file

@ -1100,7 +1100,7 @@ public class ResourceManager {
} }
} }
} }
return readers.toArray(new BinaryMapIndexReader[readers.size()]); return readers.toArray(new BinaryMapIndexReader[0]);
} }
public BinaryMapIndexReader[] getTransportRoutingMapFiles() { public BinaryMapIndexReader[] getTransportRoutingMapFiles() {
@ -1114,7 +1114,7 @@ public class ResourceManager {
} }
} }
} }
return readers.toArray(new BinaryMapIndexReader[readers.size()]); return readers.toArray(new BinaryMapIndexReader[0]);
} }
public BinaryMapIndexReader[] getQuickSearchFiles() { public BinaryMapIndexReader[] getQuickSearchFiles() {
@ -1129,7 +1129,7 @@ public class ResourceManager {
} }
} }
} }
return readers.toArray(new BinaryMapIndexReader[readers.size()]); return readers.toArray(new BinaryMapIndexReader[0]);
} }
public Map<String, String> getIndexFileNames() { public Map<String, String> getIndexFileNames() {

View file

@ -121,7 +121,7 @@ public class RouteProvider {
list.add(r); list.add(r);
} }
} }
return list.toArray(new RouteService[list.size()]); return list.toArray(new RouteService[0]);
} }
} }

View file

@ -456,7 +456,7 @@ public class SRTMPlugin extends OsmandPlugin {
List<String> possibleValuesList = new ArrayList<>(Arrays.asList(p.getPossibleValues())); List<String> possibleValuesList = new ArrayList<>(Arrays.asList(p.getPossibleValues()));
possibleValuesList.remove(CONTOUR_LINES_DISABLED_VALUE); possibleValuesList.remove(CONTOUR_LINES_DISABLED_VALUE);
final String[] possibleValues = possibleValuesList.toArray(new String[possibleValuesList.size()]); final String[] possibleValues = possibleValuesList.toArray(new String[0]);
int i = possibleValuesList.indexOf(pref.get()); int i = possibleValuesList.indexOf(pref.get());
if (i >= 0) { if (i >= 0) {

View file

@ -181,7 +181,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
} }
if (imageRequests.size() > 0) { if (imageRequests.size() > 0) {
executeTaskInBackground(new PointImageReaderTask(this), imageRequests.toArray(new String[imageRequests.size()])); executeTaskInBackground(new PointImageReaderTask(this), imageRequests.toArray(new String[0]));
} }
} }
mapTextLayer.putData(this, displayedPoints); mapTextLayer.putData(this, displayedPoints);

View file

@ -1387,7 +1387,7 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
bld.setTitle(R.string.map_magnifier); bld.setTitle(R.string.map_magnifier);
bld.setSingleChoiceItems(values.toArray(new String[values.size()]), i, bld.setSingleChoiceItems(values.toArray(new String[0]), i,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {

View file

@ -222,7 +222,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
@Override @Override
public List<String> execute(List<Struct> listCmd){ public List<String> execute(List<Struct> listCmd){
Struct list = new Struct(listCmd.toArray(new Term[listCmd.size()])); Struct list = new Struct(listCmd.toArray(new Term[0]));
Var result = new Var("RESULT"); //$NON-NLS-1$ Var result = new Var("RESULT"); //$NON-NLS-1$
List<String> files = new ArrayList<String>(); List<String> files = new ArrayList<String>();
if(prologSystem == null) { if(prologSystem == null) {

View file

@ -216,7 +216,7 @@ public class TravelDbHelper {
} }
query += ") "; query += ") ";
if (params.size() > 0) { if (params.size() > 0) {
SQLiteCursor cursor = conn.rawQuery(query, params.toArray(new String[params.size()])); SQLiteCursor cursor = conn.rawQuery(query, params.toArray(new String[0]));
if (cursor != null) { if (cursor != null) {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
@ -468,7 +468,7 @@ public class TravelDbHelper {
params.add(lang); params.add(lang);
} }
} }
SQLiteCursor cursor = conn.rawQuery(query.toString(), params.toArray(new String[params.size()])); SQLiteCursor cursor = conn.rawQuery(query.toString(), params.toArray(new String[0]));
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
do { do {
WikivoyageSearchResult rs = new WikivoyageSearchResult(); WikivoyageSearchResult rs = new WikivoyageSearchResult();

View file

@ -341,7 +341,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
res.add(item); res.add(item);
} }
} }
return res.toArray(new IndexItem[res.size()]); return res.toArray(new IndexItem[0]);
} }
@NonNull @NonNull

View file

@ -128,7 +128,7 @@ public class CurrentPositionHelper {
} }
private void initCtx(SampleApplication app, List<BinaryMapIndexReader> checkReaders) { private void initCtx(SampleApplication app, List<BinaryMapIndexReader> checkReaders) {
BinaryMapIndexReader[] rs = checkReaders.toArray(new BinaryMapIndexReader[checkReaders.size()]); BinaryMapIndexReader[] rs = checkReaders.toArray(new BinaryMapIndexReader[0]);
if (rs.length > 0) { if (rs.length > 0) {
RoutingConfiguration defCfg = RoutingConfiguration.getDefault().build("geocoding", 10, RoutingConfiguration defCfg = RoutingConfiguration.getDefault().build("geocoding", 10,
new HashMap<String, String>()); new HashMap<String, String>());