for (car_gps car_gps : locList) {
if(car_gps.getGps_lat().contains("E")||car_gps.getGps_lng().contains("E")){ //排除异常坐标
locList.remove(car_gps);
}
}
PHP中文网2017-04-18 10:24:29
When foreach loops a list, you cannot remove elements of the looped list in the loop body. You can use the iterator method, or record the index of the element to be deleted first, and then delete the elements with corresponding indexes after the for loop ends.
PHP中文网2017-04-18 10:24:29
Brother, how do we know what is in locList? What is the car_gps object? At least give me an error message