private void addToMap(Map<String, Map<String, String>> map, Set<PropertyInfo> stackProperties) {
    for (PropertyInfo pi : stackProperties) {
      String type = ConfigHelper.fileNameToConfigType(pi.getFilename());

      if (!map.containsKey(type)) {
        map.put(type, new HashMap<>());
      }
      map.get(type).put(pi.getName(), pi.getValue());
    }

  }
Class that assists with merging configuration values across stacks.
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java