I have a HashMap<String, Integer>
which I need to save across resumes/restarts, across the activity lifecycle, when app restarts etc.
There are the following options:
1) Use shared preferences and loop over all keys and store the <key,value>
pairs exactly like this in shared preferences
2) Convert the hashmap to JSON and save as a String in shared preferences.
3) Since hashmap is serializable then save it as such in internal memory.
But what is the best approach performance wise? What is the standard/best practice?
To me it seems option (3) but from various posts many people say the opposite. Is the overhead of serializable that much for my specific definition of hashmap? I.e. no complex object keys-values?