if statemnt added in case of empty

This commit is contained in:
Adam Domagalski 2018-11-07 00:28:19 +01:00
parent 295be86eee
commit 5d595c4c65

View File

@ -348,12 +348,19 @@ public class MapActivity extends BaseActivity
@Override
public void onSuccess(List<Coordinate> coordsList) {
ArrayList<String> currentCoordsIds = new ArrayList<>();
for (Coordinate coordinate : coordsList) {
currentCoordsIds.add(coordinate.getUserId());
if(coordsList.isEmpty()) {
Log.e(tag, "200 empty []");
mapboxMap.clear();
return;
}
// Set<String> currentCoordsIds = new HashSet<String>(tmp);
ArrayList<String> tmp = new ArrayList<>();
for (Coordinate coordinate : coordsList) {
tmp.add(coordinate.getUserId());
}
Set<String> currentCoordsIds = new HashSet<>(tmp);
if (previousCoordsIds.isEmpty()){
previousCoordsIds.addAll(currentCoordsIds);
} else {
@ -366,6 +373,7 @@ public class MapActivity extends BaseActivity
coordsMap.remove(toRemoveId);
}
} else {
// TODO double check when some markers api will change
Log.e(tag+ "delete: ","nothing to remove");
}
}