Here you can find the source of join(String separator, List
public static String join(String separator, List<String> data)
//package com.java2s; import java.util.List; public class Main { public static String join(String separator, List<String> data) { StringBuilder sb = new StringBuilder(); for (String item : data) { if (sb.length() > 0) sb.append(separator);//from w w w. j av a2 s . c om sb.append(item); } return sb.toString(); } }