@Test public void testJoinArray() { StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<String>(); Util.join(sb, list.toArray(new String[list.size()]), ", "); the(sb.toString()).shouldBeEqual(""); sb = new StringBuilder(); list.add("foo"); Util.join(sb, list.toArray(new String[list.size()]), ", "); the(sb.toString()).shouldBeEqual("foo"); sb = new StringBuilder(); list.add("bar"); Util.join(sb, list.toArray(new String[list.size()]), ", "); the(sb.toString()).shouldBeEqual("foo, bar"); }
public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); }
Util { public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); } }
Util { public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); } private  Util(); }
Util { public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); } private  Util(); static byte[] readResourceBytes(String resourceName); static String readResource(String resourceName); static String readResource(String resourceName, String charset); static String readFile(String fileName); static String readFile(String fileName, String charset); static void closeQuietly(AutoCloseable autoCloseable); static void closeQuietly(AutoCloseable ... autoCloseable); static void closeQuietly(List<T> autoCloseable); static String read(InputStream in); static String read(InputStream in, String charset); static byte[] bytes(InputStream in); static byte[] read(File file); static List<String> getResourceLines(String resourceName); static boolean blank(Object value); static boolean empty(Object[] array); static boolean empty(Collection<?> collection); static String join(String[] array, String delimiter); static String[] split(String input, String delimiters); static String[] split(String input, char delimiter); static String join(Collection<?> collection, String delimiter); static void join(StringBuilder sb, Collection<?> collection, String delimiter); static void join(StringBuilder sb, Object[] array, String delimiter); static void repeat(StringBuilder sb, String str, int count); static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count); static void saveTo(String path, InputStream in); static String getCauseMessage(Throwable throwable); static String getStackTraceString(Throwable throwable); static void saveTo(String path, byte[] content); static String toBase64(byte[] input); static byte[] fromBase64(String input); String[] arr(String ... params); static Properties readProperties(String fileOrResource); static boolean createTree(Path path); static void recursiveDelete(Path directory); }
Util { public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); } private  Util(); static byte[] readResourceBytes(String resourceName); static String readResource(String resourceName); static String readResource(String resourceName, String charset); static String readFile(String fileName); static String readFile(String fileName, String charset); static void closeQuietly(AutoCloseable autoCloseable); static void closeQuietly(AutoCloseable ... autoCloseable); static void closeQuietly(List<T> autoCloseable); static String read(InputStream in); static String read(InputStream in, String charset); static byte[] bytes(InputStream in); static byte[] read(File file); static List<String> getResourceLines(String resourceName); static boolean blank(Object value); static boolean empty(Object[] array); static boolean empty(Collection<?> collection); static String join(String[] array, String delimiter); static String[] split(String input, String delimiters); static String[] split(String input, char delimiter); static String join(Collection<?> collection, String delimiter); static void join(StringBuilder sb, Collection<?> collection, String delimiter); static void join(StringBuilder sb, Object[] array, String delimiter); static void repeat(StringBuilder sb, String str, int count); static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count); static void saveTo(String path, InputStream in); static String getCauseMessage(Throwable throwable); static String getStackTraceString(Throwable throwable); static void saveTo(String path, byte[] content); static String toBase64(byte[] input); static byte[] fromBase64(String input); String[] arr(String ... params); static Properties readProperties(String fileOrResource); static boolean createTree(Path path); static void recursiveDelete(Path directory);  }