Here you can find the source of toMap(String s)
public static Map<String, String> toMap(String s)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { private static final String K_V_SEPARATOR = "=>"; public static Map<String, String> toMap(String s) { Map<String, String> m = new HashMap<String, String>(); if (s == null || s.trim().isEmpty()) { return m; }/*w w w . j av a2s. com*/ String[] tokens = s.split(", "); for (String token : tokens) { String[] kv = token.split(K_V_SEPARATOR); String k = kv[0]; k = k.trim().substring(1, k.length() - 1); String v = kv[1]; v = v.trim().substring(1, v.length() - 1); m.put(k, v); } return m; } }