@Test public void testJoinReturningNonEmptyString() { List<String> arrayList = new ArrayList<String>(); LinkedHashSet<String> linkedHashSet = new LinkedHashSet<String>(arrayList); linkedHashSet.add(")'<Mw@ZR0IYF_l%*>"); linkedHashSet.add(null); String resultString = StringUtil.join(linkedHashSet, null); assertNotNull(resultString); assertEquals(")'<Mw@ZR0IYF_l%*>", resultString); }
public static String join(Iterable<String> parts, String separator) { if (parts == null) { return null; } Iterator<String> iterator = parts.iterator(); if (iterator == null) { return null; } else if (!iterator.hasNext()) { return ""; } else { StringBuilder buf = new StringBuilder(); final String first = iterator.next(); if (first != null) { buf.append(first); } while (iterator.hasNext()) { if (separator != null) { buf.append(separator); } final String part = iterator.next(); if (part != null) { buf.append(part); } } return buf.toString(); } }
StringUtil { public static String join(Iterable<String> parts, String separator) { if (parts == null) { return null; } Iterator<String> iterator = parts.iterator(); if (iterator == null) { return null; } else if (!iterator.hasNext()) { return ""; } else { StringBuilder buf = new StringBuilder(); final String first = iterator.next(); if (first != null) { buf.append(first); } while (iterator.hasNext()) { if (separator != null) { buf.append(separator); } final String part = iterator.next(); if (part != null) { buf.append(part); } } return buf.toString(); } } }
StringUtil { public static String join(Iterable<String> parts, String separator) { if (parts == null) { return null; } Iterator<String> iterator = parts.iterator(); if (iterator == null) { return null; } else if (!iterator.hasNext()) { return ""; } else { StringBuilder buf = new StringBuilder(); final String first = iterator.next(); if (first != null) { buf.append(first); } while (iterator.hasNext()) { if (separator != null) { buf.append(separator); } final String part = iterator.next(); if (part != null) { buf.append(part); } } return buf.toString(); } } private  StringUtil(); }
StringUtil { public static String join(Iterable<String> parts, String separator) { if (parts == null) { return null; } Iterator<String> iterator = parts.iterator(); if (iterator == null) { return null; } else if (!iterator.hasNext()) { return ""; } else { StringBuilder buf = new StringBuilder(); final String first = iterator.next(); if (first != null) { buf.append(first); } while (iterator.hasNext()) { if (separator != null) { buf.append(separator); } final String part = iterator.next(); if (part != null) { buf.append(part); } } return buf.toString(); } } private  StringUtil(); static String[] filterSystemArgs(String[] args); static String trimSuffix(String str, String suffix); static String join(Iterable<String> parts, String separator); static void toUpperCaseArray(String[] source, String[] target); static String noBlank(String str, String dft); static String dropSuffix(String str, String suffix); static String min(Collection<String> strs); static String max(Collection<String> strs); static String min(String s1, String s2); static String max(String s1, String s2); static String[] subArray(String[] array, int start, int endExclusive); static void appendWithSeparator(StringBuilder src, String append); static String[] splitAndTrim(String str, String splitBy); static String[] split(String str, String splitBy); static String[] splitByComma(String str); static int utf8Length(CharSequence sequence); static boolean equals(String a, String b); }
StringUtil { public static String join(Iterable<String> parts, String separator) { if (parts == null) { return null; } Iterator<String> iterator = parts.iterator(); if (iterator == null) { return null; } else if (!iterator.hasNext()) { return ""; } else { StringBuilder buf = new StringBuilder(); final String first = iterator.next(); if (first != null) { buf.append(first); } while (iterator.hasNext()) { if (separator != null) { buf.append(separator); } final String part = iterator.next(); if (part != null) { buf.append(part); } } return buf.toString(); } } private  StringUtil(); static String[] filterSystemArgs(String[] args); static String trimSuffix(String str, String suffix); static String join(Iterable<String> parts, String separator); static void toUpperCaseArray(String[] source, String[] target); static String noBlank(String str, String dft); static String dropSuffix(String str, String suffix); static String min(Collection<String> strs); static String max(Collection<String> strs); static String min(String s1, String s2); static String max(String s1, String s2); static String[] subArray(String[] array, int start, int endExclusive); static void appendWithSeparator(StringBuilder src, String append); static String[] splitAndTrim(String str, String splitBy); static String[] split(String str, String splitBy); static String[] splitByComma(String str); static int utf8Length(CharSequence sequence); static boolean equals(String a, String b);  }