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);
  }
@Test
  void nullMap() {
    // Act
    Map<String, Collection<String>> actualMap = caseInsensitiveCopyOf(null);
    // Assert result
    assertThat(actualMap)
        .isNotNull()
        .isEmpty();
  }