map集合的key转换大小写

map集合中的所有key转换大小写:

 List<Map<String,Object>> entityList = this.entityService.findEntityAll(param);
 List<Map<String,Object>> mapList= new ArrayList<>();
 for (Map<String, Object> map : entityList ) {
            Map<String,Object> resultMap = new HashMap<>();
            Set<String> sets = map.keySet();
            for (String key : sets) {
                resultMap.put(key.toLowerCase(), map.get(key));		//全转小写
                //resultMap.put(key.toUpperCase(), map.get(key));	//全转大写
            }
            mapList.add(resultMap);
 }
 return mapList;

你可能感兴趣的:(小知识点,java,map)