I met a problem when I want to assign the parking to each order, and then remove the parking-assined order from other parkings' order sets. This array list arr_assignedOrderSet has a size of 22, so it was supposed to iterate 22 times. But I have no idea why it stoped after 11 times. If I replace the iterated times arr_assignedOrderSet.size() with 22, it will show me an error of "java.lang.IndexOutOfBoundsException: Index 11 out of bounds for length 11". The codes are as following:
ArrayList<Order> arr_assignedOrderSet = new ArrayList<Order>();
arr_assignedOrderSet = pop_parkings.get(index).orderSet;
for(int i=0; i<arr_assignedOrderSet.size(); i++){
Order order = arr_assignedOrderSet.get(i);
for(int j=0; j<order.col_parking.size(); j++){
Parking p = order.col_parking.get(j);
p.orderSet.remove(order);
}
}
Thanks a lot for your help~ ;-)