0

Say I have this rather complex HashMap:

Map<> map = new HashMap<String, HashMap<ArrayList<String>,Double>>();

With the Arrays.asList() function, it prints out as a string in a readable manner, and I can write it to a text file.

Is there a way to begin with a text file with the output of this HashMap as a string printed into it, and compile it back into a HashMap?

  • Have a look at *serialization* and *deserialization* – Lino Jul 19 '18 at 08:33
  • Maybe as a first hint: [Java: Writting/Reading a Map from disk](https://stackoverflow.com/questions/4738162/java-writting-reading-a-map-from-disk) – LuCio Jul 19 '18 at 08:35
  • 2
    By the way that HashMap declaration strongly suggest that your design is lacking. You have a "map of strings to map of list of strings to double", whereas you really should create some classes where you store that data, ending with something like `Map`. – Kayaman Jul 19 '18 at 08:41

0 Answers0