I have used a HashMap to store information that I needed on a text document using the code below, how would I now go about loading the data back into my program, currently the saving works just fine.
The text file currently stores
KEY=VALUE
so for example my text file would be:
1=value
2=value
3=value
The current way I save things to this file (not sure if relevant) is this:
public void save(HashMap<Integer, String> map) {
try {
File zone1 = new File("zones/zone1");
FileOutputStream fileOut = new FileOutputStream(zone1);
PrintWriter print = new PrintWriter(fileOut);
for (Map.Entry<Integer, String> m : map.entrySet()) {
print.println(m.getKey() + "=" + m.getValue());
}
print.flush();
print.close();
print.close();
} catch (Exception e) {
}
}