I have a String which is coming in particular format so I want to parse that string into map. I have a below method which parses String to a Map and it works fine.

```
  public static Map<String, String> parseStringToMap(String payload) {
    try {
      return Maps.newHashMap(Splitter.on("|").withKeyValueSeparator("=").split(payload));
    } catch (Exception ex) {
      return ImmutableMap.of();
    }
  }

```

Sample example of a string:

```
"type=3|Id=23456|user=13456"

```

Now sometimes when I have same key twice with same value in the same String `payload`, then my above method fails and it throws exception. For example for below string, it doesn't work and it fails and then it returns empty map because it has `type` key twice.

```
"type=3|Id=23456|user=13456|type=3"

```

What can I do to fix this instead of fixing the string payload? So let's say if same key comes many times, then overwrite that key value in the map instead of failing. And I want to return a Mutable map back.

I am still working with Java 7. What is the best and efficient way to do this?