@Test public void joinTest() { { String[] arr = {"a", "b", "c"}; assertEquals("a-b-c", CollectionUtils.join(arr, "-")); } { List<Integer> list = new LinkedList<>(); assertEquals("", CollectionUtils.join(list, ", ")); list.add(1); list.add(2); list.add(3); assertEquals("1, 2, 3", CollectionUtils.join(list, ", ")); assertEquals("1null2null3", CollectionUtils.join(list, null)); } }
public static <T> String join(T[] arr, String separator) { return join(Arrays.asList(arr), separator); }
CollectionUtils { public static <T> String join(T[] arr, String separator) { return join(Arrays.asList(arr), separator); } }
CollectionUtils { public static <T> String join(T[] arr, String separator) { return join(Arrays.asList(arr), separator); } private  CollectionUtils(); }
CollectionUtils { public static <T> String join(T[] arr, String separator) { return join(Arrays.asList(arr), separator); } private  CollectionUtils(); static List<String> removeAllByStrWithSeparator(List<String> originList,
                                                           String strWithSeparator, String separator); static Object[] intersection(Object[] a, Object[] b); static Collection<T> intersection(Collection<T> a, Collection<T> b); static Object getDuplicate(Collection<E> coll, E o, String field, Class fieldClass); static Object getDuplicate(Collection<E> coll, E o, String fieldName,
                                          Class fieldClass, Class elementClass); static Collection<T> remove(Collection<T> coll, final String field, final Object... removes); static int getNthNumberMin(int[] arr, int n); static int getNthNumberMax(int[] arr, int n); static Map<Y, Map<X, Z>> exchangeKeys(Map<X, Map<Y, Z>> map); static String join(T[] arr, String separator); static String join(Collection<T> list, String separator); }
CollectionUtils { public static <T> String join(T[] arr, String separator) { return join(Arrays.asList(arr), separator); } private  CollectionUtils(); static List<String> removeAllByStrWithSeparator(List<String> originList,
                                                           String strWithSeparator, String separator); static Object[] intersection(Object[] a, Object[] b); static Collection<T> intersection(Collection<T> a, Collection<T> b); static Object getDuplicate(Collection<E> coll, E o, String field, Class fieldClass); static Object getDuplicate(Collection<E> coll, E o, String fieldName,
                                          Class fieldClass, Class elementClass); static Collection<T> remove(Collection<T> coll, final String field, final Object... removes); static int getNthNumberMin(int[] arr, int n); static int getNthNumberMax(int[] arr, int n); static Map<Y, Map<X, Z>> exchangeKeys(Map<X, Map<Y, Z>> map); static String join(T[] arr, String separator); static String join(Collection<T> list, String separator);  }