com.sinch.sdk.core.utils.MapUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.core.utils;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
public class MapUtils {
/**
* @param headers Map to be transformed
* @return A cloned map with case-insensitive comparator when looking for key value
*/
public static Map getCaseInsensitiveMap(Map headers) {
// convert header keys to use case-insensitive map keys
Map caseInsensitiveHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
// ensure no null key value
headers.entrySet().removeIf(entry -> Objects.isNull(entry.getKey()));
caseInsensitiveHeaders.putAll(headers);
return caseInsensitiveHeaders;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy