Performance: 'List.remove()' called in loop

This commit is contained in:
TacoTheDank 2020-11-19 15:20:30 -05:00
parent 6b16170168
commit 901827458f

View file

@ -325,9 +325,7 @@ public class TransportStopsRouteReader {
// merge first part // merge first part
if (commonStopFirst < commonStopSecond if (commonStopFirst < commonStopSecond
|| (commonStopFirst == commonStopSecond && firstSegment.get(0).isMissingStop())) { || (commonStopFirst == commonStopSecond && firstSegment.get(0).isMissingStop())) {
for (int i = 0; i <= commonStopFirst; i++) { firstSegment.subList(0, commonStopFirst + 1).clear();
firstSegment.remove(0);
}
for (int i = commonStopSecond; i >= 0; i--) { for (int i = commonStopSecond; i >= 0; i--) {
firstSegment.add(0, segmentToMerge.get(i)); firstSegment.add(0, segmentToMerge.get(i));
} }