Category mParent; CategoryImageLink l;
IObject ioParent, ioChild;
    public void classify(Set images, Set categories)            throws DSOutOfServiceException, DSAccessException    {        try {            images.toArray(new ImageData[] {});        } catch (ArrayStoreException ase) {            throw new IllegalArgumentException(                    "images only contains ImageData elements.");        }        try {            categories.toArray(new CategoryData[] {});        } catch (ArrayStoreException ase) {            throw new IllegalArgumentException(                    "categories only contains CategoryData elements.");        }                Iterator category = categories.iterator();        Iterator image;        List objects = new ArrayList();        Category mParent;        CategoryImageLink l;        while (category.hasNext()) {            mParent = ((DataObject) category.next()).asCategory();            image = images.iterator();            while (image.hasNext()) {                l = new CategoryImageLink();                l.link(mParent, ((DataObject) image.next()).asImage());                objects.add(l);            }           }        if (objects.size() != 0) {            Iterator i = objects.iterator();            IObject[] array = new IObject[objects.size()];            int index = 0;            while (i.hasNext()) {                array[index] = (IObject) i.next();                index++;            }            gateway.createObjects(array, (new PojoOptions()).map());        }    }