protected boolean equals()

in config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSupport.java [66:95]


    protected boolean equals(Dictionary source, Dictionary target) {
        if (source == null && target == null)
            return true;

        if (source == null || target == null)
            return false;

        if (source.isEmpty() && target.isEmpty())
            return true;

        if (source.size() != target.size())
            return false;

        Enumeration sourceKeys = source.keys();
        while (sourceKeys.hasMoreElements()) {
            Object key = sourceKeys.nextElement();
            if (!key.equals(org.osgi.framework.Constants.SERVICE_PID)) {
                Object sourceValue = source.get(key);
                Object targetValue = target.get(key);
                if (sourceValue != null && targetValue == null)
                    return false;
                if (sourceValue == null && targetValue != null)
                    return false;
                if (!sourceValue.equals(targetValue))
                    return false;
            }
        }

        return true;
    }