ArrayList<ArrayList<ClockEvent>> expressLine = new ArrayList<>();//list of lists
int expLane = laneScan.nextInt();//amount of lists to make
for(int i = 0; i < expLane; i++){
ArrayList<ClockEvent> checkout = new ArrayList<>();//making multiple lists
expressLine.add(checkout);//add this particular list to the list of lists
}
for(ClockEvent obj: ListOfObjectsToAdd){
//add current object to list..remove object..move to next list..add next object..repeat?
//ive tried may ways but i keep getting a ConcurrentModificationException
}
//here is one attempt
for(int i = 0; i < regularLine.size();i++){
ArrayList arr = regularLine.get(i);
for(ClockEvent curr: regCheckoutLine){
arr.add(curr);
regCheckoutLine.remove(curr);
}
System.out.println(arr.size());
}
//The exception is pinged on the enhanced for loop over the ClockEvent objects
非常感谢帮助,但遗憾的是,如果您给出正确答案或帮助了解这是我的第一个问题并且我今天刚刚加入,我就不能投票给您