有一些关于我的代码,我不明白。 当我执行下面的代码className1和value1从条目中获取它们的值,但是当为className2我得到ClassCastException日期不能转换为字符串时处理条目与getValue = {[email protected] }“孙军01 00:00:00 1997年PDT”在Map.Entry中的classCastException
String key1="", className1="", value1="";
String key2="", className2="", value2="";
Object obj;
Map<String, String> inputValues = reportOptions.getInputValues();
for (Map.Entry<String, String> entry: inputValues.entrySet()){
key1 = entry.getKey().toString();
obj = entry.getValue();
className1 = obj.getClass().getName();
value1 = obj.toString();
className2 = entry.getValue().getClass().getName();
value2 = entry.getValue().toString();
}
应该是简单的,但我失踪了......
你能告诉我们,填充inputValues地图的代码? –