Skip to content
Advertisement

Convert String to Hashmap in Java

I have the following string:

JavaScript

I want to convert it back to hashmap. I tried the following code below

JavaScript

but the problem is that it can’t convert the string with spaces. It outputs something like this:

JavaScript

I think it has something to do with the regex. Help! Thanks.

Advertisement

Answer

Something like this will work for you :

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement