Here you can find the source of join(Collection tokens, String separator)
public static String join(Collection tokens, String separator)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.Collection; import java.util.Iterator; public class Main { public static String join(String separator, Object... tokens) { return join(Arrays.asList(tokens), separator); }/*from w w w. j av a2 s. co m*/ public static String join(Collection tokens, String separator) { StringBuffer sb = new StringBuffer(); for (Iterator it = tokens.iterator(); it.hasNext();) { Object o = it.next(); if (o != null) { sb.append(o.toString()); } else { sb.append("NULL"); } if (it.hasNext()) { sb.append(separator); } } return sb.toString(); } }