@Test public void testParseMapInMap() { Map<String, Map<String, String>> keyMapValues = underTest.parseMapInMap("K1#k1:v1,k2:v2;K2#k3:v3,k4:v4"); Map<String, String> keyValues1 = keyMapValues.get("K1"); Map<String, String> keyValues2 = keyMapValues.get("K2"); assertNotNull(keyValues1); assertNotNull(keyValues2); assertEquals("v1", keyValues1.get("k1")); assertEquals("v2", keyValues1.get("k2")); assertEquals("v3", keyValues2.get("k3")); assertEquals("v4", keyValues2.get("k4")); }
public Map<String, Map<String, String>> parseMapInMap(String mapInMapStr) { Map<String, Map<String, String>> mapInMap = new HashMap<>(); Map<String, String> outerMap = parseMap(mapInMapStr, ";", "#"); if (!outerMap.isEmpty()) { for (Map.Entry<String, String> entry : outerMap.entrySet()) { Map<String, String> keyValueMap = parseMap(entry.getValue()); if (!keyValueMap.isEmpty()) { mapInMap.put(entry.getKey(), keyValueMap); } } } return mapInMap; }
PropertiesSplitter { public Map<String, Map<String, String>> parseMapInMap(String mapInMapStr) { Map<String, Map<String, String>> mapInMap = new HashMap<>(); Map<String, String> outerMap = parseMap(mapInMapStr, ";", "#"); if (!outerMap.isEmpty()) { for (Map.Entry<String, String> entry : outerMap.entrySet()) { Map<String, String> keyValueMap = parseMap(entry.getValue()); if (!keyValueMap.isEmpty()) { mapInMap.put(entry.getKey(), keyValueMap); } } } return mapInMap; } }
PropertiesSplitter { public Map<String, Map<String, String>> parseMapInMap(String mapInMapStr) { Map<String, Map<String, String>> mapInMap = new HashMap<>(); Map<String, String> outerMap = parseMap(mapInMapStr, ";", "#"); if (!outerMap.isEmpty()) { for (Map.Entry<String, String> entry : outerMap.entrySet()) { Map<String, String> keyValueMap = parseMap(entry.getValue()); if (!keyValueMap.isEmpty()) { mapInMap.put(entry.getKey(), keyValueMap); } } } return mapInMap; }  }
PropertiesSplitter { public Map<String, Map<String, String>> parseMapInMap(String mapInMapStr) { Map<String, Map<String, String>> mapInMap = new HashMap<>(); Map<String, String> outerMap = parseMap(mapInMapStr, ";", "#"); if (!outerMap.isEmpty()) { for (Map.Entry<String, String> entry : outerMap.entrySet()) { Map<String, String> keyValueMap = parseMap(entry.getValue()); if (!keyValueMap.isEmpty()) { mapInMap.put(entry.getKey(), keyValueMap); } } } return mapInMap; }  List<String> parseList(String listStr); Map<String, String> parseMap(String mapStr); Map<String, String> parseMap(String mapStr, String separator, String keyValueSeparator); Map<String, Map<String, String>> parseMapInMap(String mapInMapStr); Map<String, List<String>> parseListInMap(String listInMapStr); Map<String, List<String>> parseListInMap(String listInMapStr, String mapSeparator, String keyValueSeparator, String listSeparator); }
PropertiesSplitter { public Map<String, Map<String, String>> parseMapInMap(String mapInMapStr) { Map<String, Map<String, String>> mapInMap = new HashMap<>(); Map<String, String> outerMap = parseMap(mapInMapStr, ";", "#"); if (!outerMap.isEmpty()) { for (Map.Entry<String, String> entry : outerMap.entrySet()) { Map<String, String> keyValueMap = parseMap(entry.getValue()); if (!keyValueMap.isEmpty()) { mapInMap.put(entry.getKey(), keyValueMap); } } } return mapInMap; }  List<String> parseList(String listStr); Map<String, String> parseMap(String mapStr); Map<String, String> parseMap(String mapStr, String separator, String keyValueSeparator); Map<String, Map<String, String>> parseMapInMap(String mapInMapStr); Map<String, List<String>> parseListInMap(String listInMapStr); Map<String, List<String>> parseListInMap(String listInMapStr, String mapSeparator, String keyValueSeparator, String listSeparator);  }