@Test public void splitAll() throws Exception { String separator = ":"; Map<String, List<String>> list = null; Map<String, Map<String, String>> result = CollectionUtils.splitAll(list, separator); Assert.assertTrue(result == null); list = new HashMap<String, List<String>>(); List<String> ages = new ArrayList<String>(); ages.add("Alice:China"); ages.add("Bob:America"); list.put("nationality", ages); result = CollectionUtils.splitAll(list, separator); Assert.assertEquals("China", result.get("nationality").get("Alice")); Assert.assertEquals("America", result.get("nationality").get("Bob")); }
public static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator) { if (list == null) { return null; } Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, List<String>> entry : list.entrySet()) { result.put(entry.getKey(), split(entry.getValue(), separator)); } return result; }
CollectionUtils { public static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator) { if (list == null) { return null; } Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, List<String>> entry : list.entrySet()) { result.put(entry.getKey(), split(entry.getValue(), separator)); } return result; } }
CollectionUtils { public static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator) { if (list == null) { return null; } Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, List<String>> entry : list.entrySet()) { result.put(entry.getKey(), split(entry.getValue(), separator)); } return result; } private  CollectionUtils(); }
CollectionUtils { public static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator) { if (list == null) { return null; } Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, List<String>> entry : list.entrySet()) { result.put(entry.getKey(), split(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, Map<String, String>> splitAll(Map<String, List<String>> list, String separator) { if (list == null) { return null; } Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, List<String>> entry : list.entrySet()) { result.put(entry.getKey(), split(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);  }