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(); cblock.type = mr.getType();
mi.cities.add(cblock); mi.cities.add(cblock);
} }
for(String s : index.getAdditionalTagsList()) { mi.attributeTagsTable.addAll(index.getAdditionalTagsList());
mi.attributeTagsTable.add(s);
}
reader.addressIndexes.add(mi); reader.addressIndexes.add(mi);
reader.indexes.add(mi); reader.indexes.add(mi);
} }

View file

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

View file

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

View file

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