Java:将map中的key转化为小写


    public static Map<String, Object> transformUpperCase(Map<String, Object> orgMap)
    {
        Map<String, Object> resultMap = new HashMap<>();

        if (orgMap == null || orgMap.isEmpty())
        {
            return resultMap;
        }

        Set<String> keySet = orgMap.keySet();
        for (String key : keySet)
        {
            String newKey = key.toLowerCase();
            newKey = newKey.replace("_", "");

            resultMap.put(newKey, orgMap.get(key));
        }

        return resultMap;
©️2020 CSDN 皮肤主题: 猿与汪的秘密 设计师:上身试试 返回首页