Here you can find the source of join(final String... arguments)
public static String join(final String... arguments)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.Map; public class Main { public static final String SPACE = " "; public static String join(final String... arguments) { return join( isEmpty((Object[]) arguments) ? null : Arrays.asList(arguments), SPACE); }//from w ww . ja v a2 s . co m public static String join(final Iterable<String> arguments) { return join(arguments, SPACE); } public static String join(final Iterable<String> arguments, final String delimiter) { final StringBuilder buffer = new StringBuilder(); if (arguments != null) { boolean first = true; for (final String arg : arguments) { if (arg != null) { if (first) { first = false; } else { buffer.append(delimiter); } buffer.append(arg); } } } return trimToNull(buffer); } public static boolean isEmpty(final Object... arguments) { return arguments == null || arguments.length == 0; } public static boolean isEmpty(final Map map) { return map == null || map.isEmpty(); } public static String trimToNull(final Object text) { if (text != null) { final String trim = text.toString().trim(); return trim.length() > 0 ? trim : null; } return null; } }