Here you can find the source of join(char separator, List extends CharSequence> seqs)
public static String join(char separator, List<? extends CharSequence> seqs)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.List; public class Main { public static String join(char separator, String... strs) { return join(Character.toString(separator), false, Arrays.asList(strs)); }// w w w .java2s . c om public static String join(char separator, List<? extends CharSequence> seqs) { return join(Character.toString(separator), false, seqs); } public static String join(CharSequence separator, String... strs) { return join(separator, false, Arrays.asList(strs)); } public static String join(CharSequence separator, List<? extends CharSequence> seqs) { return join(separator, false, seqs); } public static String join(char separator, boolean trailingSeparator, String... strs) { return join(Character.toString(separator), trailingSeparator, Arrays.asList(strs)); } public static String join(char separator, boolean trailingSeparator, List<? extends CharSequence> seqs) { return join(Character.toString(separator), trailingSeparator, seqs); } public static String join(CharSequence separator, boolean trailingSeparator, String... strs) { return join(separator, trailingSeparator, Arrays.asList(strs)); } public static String join(CharSequence separator, boolean trailingSeparator, List<? extends CharSequence> seqs) { // Calculate length of buffer int length = (separator == null) ? 0 : separator.length() * seqs.size(); for (CharSequence seq : seqs) length += seq.length(); // Concatenate character sequences StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < seqs.size(); ++i) { if ((separator != null) && (i > 0)) buffer.append(separator); buffer.append(seqs.get(i)); } if ((separator != null) && trailingSeparator) buffer.append(separator); return buffer.toString(); } }