Here you can find the source of join(String delimiter, Iterable
public static String join(String delimiter, Iterable<String> strings)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static String join(String delimiter, Iterable<String> strings) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String str : strings) { if (first) { first = false;//ww w.j a va 2s.co m } else { sb.append(delimiter); } sb.append(str); } return sb.toString(); } public static String join(String delimiter, String... strings) { return join(delimiter, Arrays.asList(strings)); } }