task = (Task) refillRequisitions.get(i); if ((task != null) && task.beforeCommitment(now)) { refillRequisitions.set(i, null); taskList.add(task); }
refills = (ArrayList) refillRequisitions.get(i); if(refills != null) { ArrayList refillsToRemove = new ArrayList(refills.size()); for(int j=0; j < refills.size() ; j++) { task = (Task) refills.get(j); if ((task != null) && task.beforeCommitment(now)) { if(!taskList.contains(task)) { taskList.add(task); } refillsToRemove.add(task); } } refills.removeAll(refillsToRemove); if(refills.size() < 1) { refillRequisitions.set(i, null); } }
    public List clearRefillTasks(Date now) {        // remove uncommitted refill tasks. Add all removed        // tasks to a second list that will be returned        // for comparison        Task task;        ArrayList taskList = new ArrayList();        for (int i = 0; i < refillRequisitions.size(); i++) {            task = (Task) refillRequisitions.get(i);            if ((task != null) && task.beforeCommitment(now)) {                refillRequisitions.set(i, null);                taskList.add(task);            }        }        return taskList;    }