MapUtils.getFloat(Map, key)
将map的key对应的value结果转换为float
MapUtils.getString(Map, key, a)
将map的key对应的value结果转换为String,如果转换失败则使用默认值a
例子:
Map<String, Object> queryMap = new HashMap<>();
queryMap.put("myKey","myValue");
String str=MapUtils.getString(queryMap, "myKey","");
System.out.println(str);
打印结果为:myValue
Map<String, Object> queryMap = new HashMap<>();
String str=MapUtils.getString(queryMap, "myKey","我是默认值");
System.out.println(str);
打印结果为:我是默认值
参考: