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