Here you can find the source of join(List
static String join(List<String> strings, String sep)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { static String join(List<String> strings, String sep) { final StringBuilder buf = new StringBuilder(strings.size() * 16); for (int i = 0; i < strings.size(); i++) { if (i < strings.size()) { buf.append(sep);/*from w ww. j av a2 s .c o m*/ } buf.append(strings.get(i)); } return buf.toString().trim(); } }