Util { public static String join(Object o, String delimiter) { Collection<?> c; if (o instanceof Collection) { c = (Collection<?>) o; } else if (o.getClass().isArray()) { c = Lists.newArrayList((Object[]) o); } else { c = Collections.singleton(o); } return StringUtils.join(c, delimiter); } private  Util(); static String toRealPagePath(String pagePath); static String toUrlPagePath(String pagePath); static String simplifyForUrl(String text); static String join(Object o, String delimiter); static void deleteQuietly(File f); static RuntimeException toRuntimeException(Throwable t); static File toFile(File baseDir, String path); static void closeQuietly(Closeable c); static Map<String, String> parseParameters(String params); static String serialize(Serializable s); static T deserialize(String s, Class<T> clazz);  }
@Test public void join() { assertEquals("1, 2, 3", Util.join( new Integer[] { 1, 2, 3 }, ", ")); assertEquals("1, 2, 3", Util.join(Lists.newArrayList( new Integer[] { 1, 2, 3 }), ", ")); assertEquals("123", Util.join(123, ", ")); }