public static <K> Map<K, String> internValuesInMap(Map<K, String> map) {
    if (map != null) {
      for (Map.Entry<K, String> entry : map.entrySet()) {
        String value = entry.getValue();
        // Intern values only when they are not part of the String pool already
        if (value != null && value != value.intern()) {
          map.put(entry.getKey(), value.intern());
        }
      }
    }
    return map;
  }
Interns all the strings in the given array in place, returning the same array
common/src/java/org/apache/hadoop/hive/common/StringInternUtils.java