@Test public void whenSeparatorInputIsIncompleteShouldJoinStrings() { List<String> list = Arrays.asList("a", "b", ""); String result = StringUtils.join(list, ","); assertThat(result, is("a,b,")); }
public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); }
StringUtils { public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); } }
StringUtils { public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); } private  StringUtils(); }
StringUtils { public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); } private  StringUtils(); static String join(List<String> list, String separator); static String convertToUUIDString(String value); }
StringUtils { public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); } private  StringUtils(); static String join(List<String> list, String separator); static String convertToUUIDString(String value);  }