我正在尝试在此数据中创建一个 csv 文件,并将其存储为键值对并正确显示值。如何将键显示为字段的标题(值)
for (Map<String, String> map : test) {
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String,String> mapEntry = (Map.Entry<String,String>) iterator.next();
//System.out.println("key: " + mapEntry.getKey() + ", value:" + mapEntry.getValue());
writer.append(mapEntry.getValue());
writer.append(",");
iterator.remove();
}
writer.append("\n");
}
writer.flush();
writer.close();
}