@Test public void join() { String s1 = "foo-bar-baz"; String s2 = "foo--bar"; Assert.assertEquals("foobarbaz", SharedUtil.join(s1.split("-"), "")); Assert.assertEquals("foo!bar!baz", SharedUtil.join(s1.split("-"), "!")); Assert.assertEquals("foo!!bar!!baz", SharedUtil.join(s1.split("-"), "!!")); Assert.assertEquals("foo##bar", SharedUtil.join(s2.split("-"), "#")); }
public static String join(String[] parts, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); sb.append(separator); } return sb.substring(0, sb.length() - separator.length()); }
SharedUtil implements Serializable { public static String join(String[] parts, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); sb.append(separator); } return sb.substring(0, sb.length() - separator.length()); } }
SharedUtil implements Serializable { public static String join(String[] parts, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); sb.append(separator); } return sb.substring(0, sb.length() - separator.length()); }  }
SharedUtil implements Serializable { public static String join(String[] parts, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); sb.append(separator); } return sb.substring(0, sb.length() - separator.length()); }  static boolean equals(Object o1, Object o2); static String trimTrailingSlashes(String value); static String[] splitCamelCase(String camelCaseString); static String camelCaseToHumanFriendly(String camelCaseString); static String join(String[] parts, String separator); static String capitalize(String string); static String propertyIdToHumanFriendly(Object propertyId); static String addGetParameters(String uri, String extraParams); static String dashSeparatedToCamelCase(String dashSeparated); }
SharedUtil implements Serializable { public static String join(String[] parts, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); sb.append(separator); } return sb.substring(0, sb.length() - separator.length()); }  static boolean equals(Object o1, Object o2); static String trimTrailingSlashes(String value); static String[] splitCamelCase(String camelCaseString); static String camelCaseToHumanFriendly(String camelCaseString); static String join(String[] parts, String separator); static String capitalize(String string); static String propertyIdToHumanFriendly(Object propertyId); static String addGetParameters(String uri, String extraParams); static String dashSeparatedToCamelCase(String dashSeparated); static final String SIZE_PATTERN; }