Here you can find the source of join(final Collection
public static String join(final Collection<Object> values, final String separator)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Iterator; public class Main { public static String join(final Collection<Object> values, final String separator) { if (values == null) return ""; StringBuilder sb = new StringBuilder(); Iterator<Object> it = values.iterator(); while (it.hasNext()) { sb.append(String.valueOf(it.next())); if (it.hasNext()) sb.append(separator);/*www .ja v a 2 s .c o m*/ } return sb.toString(); } public static String join(final Collection<Object> values) { return join(values, ", "); } }