MCPcopy Index your code
hub / github.com/OpenFeign/feign / caseInsensitiveCopyOf

Method caseInsensitiveCopyOf

core/src/main/java/feign/Util.java:325–343  ·  view source on GitHub ↗

Copy entire map of string collection. 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.

(
      Map<String, Collection<String>> map)

Source from the content-addressed store, hash-verified

323 * @return copy of the map or an empty map if the map is null.
324 */
325 public static Map<String, Collection<String>> caseInsensitiveCopyOf(
326 Map<String, Collection<String>> map) {
327 if (map == null) {
328 return Collections.emptyMap();
329 }
330
331 Map<String, Collection<String>> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
332
333 for (Map.Entry<String, Collection<String>> entry : map.entrySet()) {
334 String key = entry.getKey();
335 if (!result.containsKey(key)) {
336 result.put(key.toLowerCase(Locale.ROOT), new LinkedList<>());
337 }
338 result.get(key).addAll(entry.getValue());
339 }
340 result.replaceAll((key, value) -> Collections.unmodifiableCollection(value));
341
342 return Collections.unmodifiableMap(result);
343 }
344
345 public static <T extends Enum<?>> T enumForName(Class<T> enumClass, Object object) {
346 String name = (nonNull(object)) ? object.toString() : null;

Callers 6

copyIsUnmodifiableMethod · 0.80
nullMapMethod · 0.80
ResponseMethod · 0.80
FeignExceptionMethod · 0.80
TypedResponseMethod · 0.80

Calls 4

containsKeyMethod · 0.80
putMethod · 0.65
getMethod · 0.65
getValueMethod · 0.65

Tested by 3

copyIsUnmodifiableMethod · 0.64
nullMapMethod · 0.64