Here you can find the source of join(String delimiter, Object... objects)
public static String join(String delimiter, Object... objects)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.Collection; import java.util.Iterator; public class Main { public static final String EMPTY_STRING = ""; public static String join(String delimiter, Object... objects) { return join(delimiter, Arrays.asList(objects)); }/*from w ww .j a v a2s.co m*/ public static String join(String delimiter, Collection<? extends Object> objects) { if (objects == null || objects.isEmpty()) { return EMPTY_STRING; } Iterator<? extends Object> iterator = objects.iterator(); StringBuilder builder = new StringBuilder(); builder.append(iterator.next()); while (iterator.hasNext()) { builder.append(delimiter).append(iterator.next()); } return builder.toString(); } }