Iterator i = group.getCategories().iterator(); Map ids = new HashMap(); CategorySummary cs; Iterator k; Object obj; while (i.hasNext()) { cs = (CategorySummary) i.next(); k = cs.getImages().iterator(); while (k.hasNext()) { obj = k.next(); ids.put(obj, obj); } } List images = new ArrayList(); List userImages = registry.getDataManagementService().retrieveImagesInUserDatasets(); Iterator j = userImages.iterator(); ImageSummary is; while (j.hasNext()) { is = (ImageSummary) j.next(); if (!ids.containsKey(new Integer(is.getID()))) images.add(is); } return images;
return retrieveImagesInUserDatasetsNotInCategoryGroup(group, null);
    public List retrieveImagesInUserDatasetsNotInCategoryGroup(            CategoryGroupData group)        throws DSOutOfServiceException, DSAccessException    {        Iterator i = group.getCategories().iterator();        Map ids = new HashMap();        CategorySummary cs;        Iterator k;        Object obj;        while (i.hasNext()) {            cs = (CategorySummary) i.next();            k = cs.getImages().iterator();            while (k.hasNext()) {                obj = k.next(); //Integer                ids.put(obj, obj);            }          }        List images = new ArrayList();        List userImages =             registry.getDataManagementService().retrieveImagesInUserDatasets();        Iterator j = userImages.iterator();        ImageSummary is;        while (j.hasNext()) {            is = (ImageSummary) j.next();            if (!ids.containsKey(new Integer(is.getID())))                images.add(is);        }        return images;    }