public static Map<String, String> intern(Map<String, String> map) {
    if (map == null) {
      return null;
    }

    if (map.isEmpty()) {
      // nothing to intern
      return map;
    }
    Map<String, String> newMap = new HashMap<>(map.size());
    for (Map.Entry<String, String> entry : map.entrySet()) {
      newMap.put(intern(entry.getKey()), intern(entry.getValue()));
    }
    return newMap;
  }
Return an interned map with identical contents as the given map.
@param map The map whose strings will be interned
@return An identical map with its strings interned.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/StringUtils.java