Fix modifying markers list

This commit is contained in:
PavelRatushny 2017-11-13 16:00:24 +02:00
parent a44518009e
commit a19ffdb884

View file

@ -282,7 +282,7 @@ public class MapMarkersHelper {
} }
private void removeFromMapMarkersList(MapMarker marker) { private void removeFromMapMarkersList(MapMarker marker) {
List<MapMarker> copyList = new ArrayList<>(); List<MapMarker> copyList = new ArrayList<>(mapMarkers);
copyList.remove(marker); copyList.remove(marker);
mapMarkers = copyList; mapMarkers = copyList;
} }
@ -302,7 +302,7 @@ public class MapMarkersHelper {
} }
private void addToMapMarkersList(int position, List<MapMarker> markers) { private void addToMapMarkersList(int position, List<MapMarker> markers) {
List<MapMarker> copyList = new ArrayList<>(); List<MapMarker> copyList = new ArrayList<>(mapMarkers);
copyList.addAll(position, markers); copyList.addAll(position, markers);
mapMarkers = copyList; mapMarkers = copyList;
} }