I have a string variable. I need to typecast this variable to a map variable. For instance:
String stringVariable = "apple"
// type cast this to map (Map<string,string>) stringVariable
I would like to use apple as a map and not as a string. Is it possible?
That is not possible. You need to parse the string somehow.
That said, I have no idea how to parse
"apple"as a map. A string such as"favorite -> apple"would be more understandable.