Set dataObjects = new HashSet(); for (Iterator i = result.iterator(); i.hasNext();) { Object obj = i.next(); if (obj instanceof CategoryGroup) { CategoryGroup cg = (CategoryGroup) obj; dataObjects.add(AdapterUtils.go(cg)); } else if (obj instanceof Category) { Category ca = (Category) obj; dataObjects.add(AdapterUtils.go(ca)); } else if (obj instanceof Image) { Image img = (Image) obj; dataObjects.add(AdapterUtils.go(img)); } else { throw new RuntimeException("Method returned unexpected value type:" + obj.getClass()	); } } return dataObjects;
return AdapterUtils.adaptFoundCGCIHierarchies(result);
    public Set findCGCIHierarchies(Set imgIDs) {        Set result = proxiedInterface.findCGCIHierarchies(imgIDs);        Set dataObjects = new HashSet();        for (Iterator i = result.iterator(); i.hasNext();) {            Object obj = i.next();            if (obj instanceof CategoryGroup) {                CategoryGroup cg = (CategoryGroup) obj;                dataObjects.add(AdapterUtils.go(cg));            } else if (obj instanceof Category) {                Category ca = (Category) obj;                dataObjects.add(AdapterUtils.go(ca));             } else if (obj instanceof Image) {                Image img = (Image) obj;                dataObjects.add(AdapterUtils.go(img));            } else {                throw new RuntimeException("Method returned unexpected value type:" + obj.getClass()	);            }        }        return dataObjects;    }