Collection toKeep = new ArrayList();
Set toKeep = new HashSet();
    private Collection filterModules(Collection mds, ModuleDescriptor rootmd) {        // Make a map of ModuleId objects -> ModuleDescriptors        Map moduleIdMap = new HashMap();        for (Iterator iter = mds.iterator(); iter.hasNext();) {            ModuleDescriptor md = ((ModuleDescriptor) iter.next());            moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);        }        // recursively process the nodes        Collection toKeep = new ArrayList();        processFilterNode(rootmd, toKeep, moduleIdMap);        // just for logging        for (Iterator iter = toKeep.iterator(); iter.hasNext();) {            ModuleDescriptor md = ((ModuleDescriptor) iter.next());            Message.verbose("Kept module " + md.getModuleRevisionId().getModuleId().getName());        }        return toKeep;    }