private Map<String, Map<String, String>> deepCopy(Map<String, Map<String, String>> map) {
    if (map == null) {
      return null;
    } else {
      Map<String, Map<String, String>> copy = new HashMap<>();

      for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) {
        Map<String, String> innerMap = entry.getValue();
        copy.put(entry.getKey(), (innerMap == null) ? null : new HashMap<>(innerMap));
      }

      return copy;
    }
  }
Creates a deep copy of a map of maps, typically used to copy configuration sets.

@param map the map to copy
@return a deep copy of the supplied map
ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java