Performance: Bulk operation can be used instead of iteration

This commit is contained in:
TacoTheDank 2020-11-19 15:15:19 -05:00
parent 88edf800d0
commit 17b0b997eb
4 changed files with 5 additions and 12 deletions

View file

@ -241,9 +241,7 @@ public class CachedOsmandIndexes {
cblock.type = mr.getType();
mi.cities.add(cblock);
}
for(String s : index.getAdditionalTagsList()) {
mi.attributeTagsTable.add(s);
}
mi.attributeTagsTable.addAll(index.getAdditionalTagsList());
reader.addressIndexes.add(mi);
reader.indexes.add(mi);
}

View file

@ -309,9 +309,7 @@ public class TargetPointsHelper {
public List<TargetPoint> getIntermediatePointsNavigation() {
List<TargetPoint> intermediatePoints = new ArrayList<>();
if (settings.USE_INTERMEDIATE_POINTS_NAVIGATION.get()) {
for (TargetPoint t : this.intermediatePoints) {
intermediatePoints.add(t);
}
intermediatePoints.addAll(this.intermediatePoints);
}
return intermediatePoints;
}

View file

@ -166,9 +166,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc
}
});
for (AbstractPoiType p : res) {
filters.add(p);
}
filters.addAll(res);
filters.add(poiFilters.getSearchByNamePOIFilter());
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) {
filters.add(poiFilters.getNominatimPOIFilter());

View file

@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -298,9 +299,7 @@ public class LogcatActivity extends ActionBarProgressActivity {
LogcatActivity activity = logcatActivity.get();
if (activity != null) {
boolean autoscroll = !activity.recyclerView.canScrollVertically(1);
for(String s : values) {
activity.logs.add(s);
}
activity.logs.addAll(Arrays.asList(values));
activity.adapter.notifyDataSetChanged();
if(autoscroll) {
activity.recyclerView.scrollToPosition(activity.logs.size() - 1);