/** * Replace all instances of the IInstallableUnits in the receiver * with the shared IInstallableUnits from the provided iuPool. * This operation is a no-op if iuPool is null. * * @param iuPool an IPool containing the shared IInstallableUnits */ public void compress(IPool<IInstallableUnit> iuPool) { if (iuPool == null) { return; } Iterator<Entry<String, Object>> entries = units.entrySet().iterator(); while (entries.hasNext()) { Entry<String, Object> entry = entries.next(); Object value = entry.getValue(); if (value.getClass().isArray()) { IInstallableUnit[] array = (IInstallableUnit[]) value; for (int i = 0; i < array.length; i++) { array[i] = iuPool.add(array[i]); } } else { entry.setValue(iuPool.add((IInstallableUnit) value)); } } } }