private Map<String, List<String>> inverseMapByValue(Map<String, String> configKeyToAction) {
    Map<String, List<String>> mapByValue = new HashMap<>();

    Iterator it = configKeyToAction.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String, String> pair = (Map.Entry) it.next();
      // Key is the config name, Value is the action (added, deleted, changed)
      if (mapByValue.containsKey(pair.getValue())) {
        mapByValue.get(pair.getValue()).add(pair.getKey());
      } else {
        List<String> configListForAction = new ArrayList<>();
        configListForAction.add(pair.getKey());
        mapByValue.put(pair.getValue(), configListForAction);
      }
    }
    return mapByValue;
  }
Inverse a HashMap of the form key_i: value_j to value_j: [key_a, ..., key_z]
for all keys that contain that value.
This is useful for printing config deltas.
@param configKeyToAction Original dictionary
@return Inverse of the dictionary.
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java