Here you can find the source of join(String s, Object... objects)
public static String join(String s, Object... objects)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(String s, Object... objects) { if (objects.length == 0) { return ""; }//from w ww. j a va2 s . c o m StringBuilder sb = new StringBuilder(objects[0].toString()); for (int i = 1; i < objects.length; i++) { sb.append(s).append(objects[i]); } return sb.toString(); } public static String join(String s, List ls) { if (ls.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(ls.get(0).toString()); for (int i = 1; i < ls.size(); i++) { sb.append(s).append(ls.get(i)); } return sb.toString(); } }