private Map<String, String> getConfigKeyDeltaToAction(Config existingConfig, Map<String, String> newConfigValues) {
    Map<String, String> configsChanged = new HashMap<>();

    if (null != existingConfig) {
      Map<String, String> existingConfigValues = existingConfig.getProperties();

      Iterator it = existingConfigValues.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry<String, String> pair = (Map.Entry) it.next();
        // Check the value if both keys exist
        if (newConfigValues.containsKey(pair.getKey())) {
          if (!newConfigValues.get(pair.getKey()).equals(pair.getValue())) {
            configsChanged.put(pair.getKey(), "changed");
          }
        } else {
          // Deleted
          configsChanged.put(pair.getKey(), "deleted");
        }
      }

      it = newConfigValues.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry<String, String> pair = (Map.Entry) it.next();
        if (!existingConfigValues.keySet().contains(pair.getKey())) {
          configsChanged.put(pair.getKey(), "added");
        }
      }
    } else {
      // All of the configs in this config type are new.
      for (String key : newConfigValues.keySet()) {
        configsChanged.put(key, "added");
      }
    }
    return configsChanged;
  }
Get a dictionary of all config differences between existingConfig and newConfigValues where the key is the config name and the action is one of "changed", "added", or "deleted".
@param existingConfig
@param newConfigValues
@return Delta of configs
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java