Set dataObjects = new HashSet(); for (Iterator i = result.iterator(); i.hasNext();) { Object obj = i.next(); if (obj instanceof Project) { Project prj = (Project) obj; dataObjects.add(AdapterUtils.go(prj)); } else if (obj instanceof Dataset) { Dataset ds = (Dataset) obj; dataObjects.add(AdapterUtils.go(ds)); } 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.adaptFoundPDIHierarchies(result);
    public Set findPDIHierarchies(Set imgIDs) {        Set result = proxiedInterface.findPDIHierarchies(imgIDs);        Set dataObjects = new HashSet();        for (Iterator i = result.iterator(); i.hasNext();) {            Object obj = i.next();            if (obj instanceof Project) {                Project prj = (Project) obj;                dataObjects.add(AdapterUtils.go(prj));            } else if (obj instanceof Dataset) {                Dataset ds = (Dataset) obj;                dataObjects.add(AdapterUtils.go(ds));             } 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;    }