Here you can find the source of join(Collection> strings, String delimiter)
public static String join(Collection<?> strings, String delimiter)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String join(String[] strings, String delimiter) { StringBuilder sb = new StringBuilder(); for (String string : strings) { if (string == null) { string = ""; }/*from ww w . ja v a 2s.co m*/ if (sb.length() > 0) { sb.append(delimiter).append(string); } else { sb.append(string); } } return sb.toString(); } public static String join(String[] strings, char delimiter) { StringBuilder sb = new StringBuilder(); for (String string : strings) { if (string == null) { string = ""; } if (sb.length() > 0) { sb.append(delimiter).append(string); } else { sb.append(string); } } return sb.toString(); } public static String join(Collection<?> strings, char delimiter) { StringBuilder sb = new StringBuilder(); for (Object string : strings) { if (string == null) { string = ""; } if (sb.length() > 0) { sb.append(delimiter).append(string.toString()); } else { sb.append(string.toString()); } } return sb.toString(); } public static String join(Collection<?> strings, String delimiter) { StringBuilder sb = new StringBuilder(); for (Object string : strings) { if (string == null) { string = ""; } if (sb.length() > 0) { sb.append(delimiter).append(string.toString()); } else { sb.append(string.toString()); } } return sb.toString(); } public static String join(Number[] strings, String delimiter) { StringBuilder sb = new StringBuilder(); for (Object string : strings) { if (string == null) { string = ""; } if (sb.length() > 0) { sb.append(delimiter).append(string.toString()); } else { sb.append(string.toString()); } } return sb.toString(); } public static String join(Number[] strings, char delimiter) { StringBuilder sb = new StringBuilder(); for (Object string : strings) { if (string == null) { string = ""; } if (sb.length() > 0) { sb.append(delimiter).append(string.toString()); } else { sb.append(string.toString()); } } return sb.toString(); } }