``
删除Map value为空的key
/* *
* @Author 尚展锋
* @Description //检测Map空的key删除
* @Date 17:31 2020/9/5
* @Param [param]
* @return java.util.Map<java.lang.String,java.lang.Object>
**/
public Map<String, Object> removeNullString(Map<String, Object> param) {
try {
Iterator<String> it = param.keySet().iterator();
while (it.hasNext()) {
Object ele = it.next();
if (param.get(ele).toString().trim().equals("")) {
//hashMap.remove(ele); //出错 修改了映射结构 影响了迭代器遍历
it.remove(); //用迭代器删除 则不会出错
}
}
return param;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}