java如何从中获取地图。txt文件使用属性?
这是写哈希表的代码。txt文件
public static void save(String filename, Map<String, String> hashtable) throws IOException {
Properties prop = new Properties();
prop.putAll(hashtable);
FileOutputStream fos = new FileOutputStream(filename);
try {
prop.store(fos, prop);
} finally {
fos.close();
}
}
我们如何从该文件中取回哈希表? 谢谢
# 1 楼答案
以同样丑陋的方式: