public static Map<String, Collection<String>> caseInsensitiveCopyOf(
      Map<String, Collection<String>> map) {
    if (map == null) {
      return Collections.emptyMap();
    }

    Map<String, Collection<String>> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

    for (Map.Entry<String, Collection<String>> entry : map.entrySet()) {
      String key = entry.getKey();
      if (!result.containsKey(key)) {
        result.put(key.toLowerCase(Locale.ROOT), new LinkedList<>());
      }
      result.get(key).addAll(entry.getValue());
    }
    result.replaceAll((key, value) -> Collections.unmodifiableCollection(value));

    return Collections.unmodifiableMap(result);
  }
Copy entire map of string collection.

<p>The copy is unmodifiable map of unmodifiable collections.

@param map string collection map
@return copy of the map or an empty map if the map is null.
core/src/main/java/feign/Util.java