Here you can find the source of join(List
private static String join(List<String> s, String delim)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static String join(List<String> s, String delim) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.size() - 1; i++) { sb.append(s.get(i));//from ww w. ja v a 2 s. c o m sb.append(delim); } if (s.size() > 0) sb.append(s.get(s.size() - 1)); return sb.toString(); } }