@Test public void joinAll() throws Exception { String separator = ":"; Map<String, Map<String, String>> map = null; Map<String, List<String>> result = CollectionUtils.joinAll(map, separator); Assert.assertTrue(result == null); map = new HashMap<String, Map<String, String>>(1); Map<String, String> nationalitys = new HashMap<String, String>(2); nationalitys.put("Alice", "China"); nationalitys.put("Bob", "America"); map.put("nationality", nationalitys); result = CollectionUtils.joinAll(map, separator); Assert.assertTrue(result.get("nationality").contains("Alice:China")); Assert.assertTrue(result.get("nationality").contains("Bob:America")); }
public static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator) { if (map == null) { return null; } Map<String, List<String>> result = new HashMap<String, List<String>>(); for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { result.put(entry.getKey(), join(entry.getValue(), separator)); } return result; }
CollectionUtils { public static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator) { if (map == null) { return null; } Map<String, List<String>> result = new HashMap<String, List<String>>(); for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { result.put(entry.getKey(), join(entry.getValue(), separator)); } return result; } }
CollectionUtils { public static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator) { if (map == null) { return null; } Map<String, List<String>> result = new HashMap<String, List<String>>(); for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { result.put(entry.getKey(), join(entry.getValue(), separator)); } return result; } private  CollectionUtils(); }
CollectionUtils { public static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator) { if (map == null) { return null; } Map<String, List<String>> result = new HashMap<String, List<String>>(); for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { result.put(entry.getKey(), join(entry.getValue(), separator)); } return result; } private  CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<String> sortSimpleName(List<String> list); static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator); static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator); static Map<String, String> split(List<String> list, String separator); static List<String> join(Map<String, String> map, String separator); static String join(List<String> list, String separator); static boolean mapEquals(Map<?, ?> map1, Map<?, ?> map2); static Map<String, String> toStringMap(String... pairs); @SuppressWarnings("unchecked") static Map<K, V> toMap(Object... pairs); static boolean isEmpty(Collection<?> collection); static boolean isNotEmpty(Collection<?> collection); }
CollectionUtils { public static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator) { if (map == null) { return null; } Map<String, List<String>> result = new HashMap<String, List<String>>(); for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { result.put(entry.getKey(), join(entry.getValue(), separator)); } return result; } private  CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<String> sortSimpleName(List<String> list); static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator); static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator); static Map<String, String> split(List<String> list, String separator); static List<String> join(Map<String, String> map, String separator); static String join(List<String> list, String separator); static boolean mapEquals(Map<?, ?> map1, Map<?, ?> map2); static Map<String, String> toStringMap(String... pairs); @SuppressWarnings("unchecked") static Map<K, V> toMap(Object... pairs); static boolean isEmpty(Collection<?> collection); static boolean isNotEmpty(Collection<?> collection);  }