@Test public void testJoin() { List<String> list1 = new ArrayList<>(); list1.add("AAA"); list1.add("BBB"); list1.add("CCC"); list1.add("AAA"); System.out.println(CollectionHelper.join(list1, "-")); Set<String> set1 = new HashSet<>(); set1.add("AAA"); set1.add("BBB"); set1.add("CCC"); System.out.println(CollectionHelper.join(set1, "-")); Map<String, String> map = new HashMap(); map.put("AAA", "AAA1"); map.put("BBB", "BBB1"); map.put("CCC", "CCC1"); map.put("DDD", "DDD1"); System.out.println(CollectionHelper.keyJoin(map, "=")); System.out.println(CollectionHelper.valueJoin(map, "=")); }
public static <T> String join(Collection<T> collection, String separator) { StringBuilder sb = new StringBuilder(); for (T t : collection) { sb.append(t.toString()).append(separator); } return sb.toString().substring(0, sb.toString().length() - 1); }
CollectionHelper { public static <T> String join(Collection<T> collection, String separator) { StringBuilder sb = new StringBuilder(); for (T t : collection) { sb.append(t.toString()).append(separator); } return sb.toString().substring(0, sb.toString().length() - 1); } }
CollectionHelper { public static <T> String join(Collection<T> collection, String separator) { StringBuilder sb = new StringBuilder(); for (T t : collection) { sb.append(t.toString()).append(separator); } return sb.toString().substring(0, sb.toString().length() - 1); }  }
CollectionHelper { public static <T> String join(Collection<T> collection, String separator) { StringBuilder sb = new StringBuilder(); for (T t : collection) { sb.append(t.toString()).append(separator); } return sb.toString().substring(0, sb.toString().length() - 1); }  static void handler(Collection<T> collection, ObjectHandler<T> handler); static void process(Collection<T> collection, Collection<E> result, ObjectProcess<T, E> process); static List<T> removeDuplicate(List<T> list); static List<T> intersection(List<T> list1, List<T> list2); static Set<T> intersection(Set<T> set1, Set<T> set2); static Queue<T> intersection(Queue<T> queue1, Queue<T> queue2); static Map<K, V> intersection(Map<K, V> map1, Map<K, V> map2); static List<T> unicon(List<T> list1, List<T> list2); static Set<T> unicon(Set<T> set1, Set<T> set2); static Queue<T> unicon(Queue<T> queue1, Queue<T> queue2); static Map<K, V> unicon(Map<K, V> map1, Map<K, V> map2); static List<T> subtract(List<T> list1, List<T> list2); static Set<T> subtract(Set<T> set1, Set<T> set2); static Queue<T> subtract(Queue<T> queue1, Queue<T> queue2); static Map<K, V> subtract(Map<K, V> map1, Map<K, V> map2); static String join(Collection<T> collection, String separator); static String join(Map<K, V> map, String separator, String separator1); static String keyJoin(Map<K, V> map, String separator); static String valueJoin(Map<K, V> map, String separator); }
CollectionHelper { public static <T> String join(Collection<T> collection, String separator) { StringBuilder sb = new StringBuilder(); for (T t : collection) { sb.append(t.toString()).append(separator); } return sb.toString().substring(0, sb.toString().length() - 1); }  static void handler(Collection<T> collection, ObjectHandler<T> handler); static void process(Collection<T> collection, Collection<E> result, ObjectProcess<T, E> process); static List<T> removeDuplicate(List<T> list); static List<T> intersection(List<T> list1, List<T> list2); static Set<T> intersection(Set<T> set1, Set<T> set2); static Queue<T> intersection(Queue<T> queue1, Queue<T> queue2); static Map<K, V> intersection(Map<K, V> map1, Map<K, V> map2); static List<T> unicon(List<T> list1, List<T> list2); static Set<T> unicon(Set<T> set1, Set<T> set2); static Queue<T> unicon(Queue<T> queue1, Queue<T> queue2); static Map<K, V> unicon(Map<K, V> map1, Map<K, V> map2); static List<T> subtract(List<T> list1, List<T> list2); static Set<T> subtract(Set<T> set1, Set<T> set2); static Queue<T> subtract(Queue<T> queue1, Queue<T> queue2); static Map<K, V> subtract(Map<K, V> map1, Map<K, V> map2); static String join(Collection<T> collection, String separator); static String join(Map<K, V> map, String separator, String separator1); static String keyJoin(Map<K, V> map, String separator); static String valueJoin(Map<K, V> map, String separator);  }