Open atjiu opened 8 years ago
public Map<String, Object> asMap() {
Map map = new HashMap();
Set<String> keys = columnNameToIdxMap.keySet();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
String colum = iterator.next().toString();
System.out.println(colum);
int index = columnNameToIdxMap.get(colum);
map.put(colum, values[index]);
}
return map;
}
public Map<String, Object> asMap() {
try {
Set<String> columnNames = columnNameToIdxMap.keySet();
Map<String, Object> map = new HashMap<String, Object>(columnNames.size());
String[] keys = columnNames.toArray(new String[columnNames.size()]);
for(int i=0, len=values.length; i<len; i++){
String key = keys[i];
Object value = getObject(key);
map.put(key, value);
}
return map;
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@biezhi 你的这个有点复杂了。
When I execute the code above, an exception is thrown
Row map does not support entrySet