I have a String that has been constructed from another LinkedHashMap using toString method, and I want to do the reverse in creating another LinkedHashMap<String, String> with this String representation of the previous LinkedHashMap.
Is it possible withing using String splits and manually doing it in a loop calling LinkedHashMap.put() ?
I think this could work?
LinkedHashMap params = new LinkedHashMap();
String[] split = paramsString2.split(",");
for (int i = 0; i < split.length; i++) {
String[] nameValue = split[i].split("=");
params.put(nameValue[0], nameValue[1]);
}
return params;
toString(other than approach you have given). What is your use case? Can't you just serialize the map and deserialize it later?