Here you can find the source of join(List
public static String join(List<String> tokens, String sep)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(List<String> tokens, String sep) { StringBuilder result = new StringBuilder(); if (!tokens.isEmpty()) { result.append(tokens.get(0)); }/*from www . j av a 2 s . c o m*/ for (String token : tokens.subList(1, tokens.size())) { result.append(sep); result.append(token); } return result.toString(); } }