我有一个问题需要解决。我想创建一个元素数量未知的ArrayList,在该ArrayList中放置其他ArrayList。例如:一个医院队列,我想在这个队列中根据患者优先级拥有不同的队列。
System.out.println("whats the maximum priority?");
int maxPriority = Scan.nextInt();
//Trying to create a new ArrayList in every ArrayList index.
for(int k=0; k<maxPriority;k++){
queues[k] = new Arraylist();
}
//trying to create a "patient"-object with a name and priority
public static patient(String name, int priority){
this.name=name;
this.priority=priority;
}
// trying to get the priority of a patient//
public static getPriority(){
return priority;
}
// Trying to add the patient last in the correct "priority queue"
public static placePatient()){
queues.add(patient.getPriority)
}