How to convert a string to a HashMap? [duplicate]

You can do that with Guava’s Splitter.MapSplitter:

Map<String, String> properties = Splitter.on(",")
    .withKeyValueSeparator(":")
    .split(inputString);

Leave a Comment