示例#1
0
 public AppointmentList getNextFreeAppointments(int numRequired) {
   AppointmentList tempAppts = new AppointmentList();
   Iterator<Appointment> iter = collection.iterator();
   Appointment currentAppt;
   while (iter.hasNext()) {
     currentAppt = iter.next();
     if (currentAppt.getPatient() == null) {
       // add to the new list of free appts
       tempAppts.collection.add(currentAppt);
     }
     if (tempAppts.collection.size() == numRequired) {
       return tempAppts;
     }
   }
   return tempAppts; // But it will be incomplete
 }