Here you can find the source of join(ArrayList
public static String join(ArrayList<String> list, String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; public class Main { public static String join(ArrayList<String> list, String delimiter) { StringBuilder stringBuilder = new StringBuilder(); Iterator<String> iterator = list.iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next()); if (!iterator.hasNext()) break; stringBuilder.append(delimiter); }//from www . ja v a2 s.co m return stringBuilder.toString(); } public static String join(String[] array, String delimiter) { return join(new ArrayList<String>(Arrays.asList(array)), delimiter); } }