Here you can find the source of join(CharSequence delimiter, List extends CharSequence> elements)
public static String join(CharSequence delimiter, List<? extends CharSequence> elements)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String join(CharSequence delimiter, List<? extends CharSequence> elements) { StringBuilder result = new StringBuilder(); for (int i = 0; i < elements.size(); i++) { result.append(elements.get(i)); if (i != elements.size() - 1) { result.append(delimiter); }/*from w w w . ja va 2 s . co m*/ } return result.toString(); } }