Here you can find the source of join(Collection
public static String join(Collection<String> values)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String join(Collection<String> values) { return join(values, ","); }// w w w.j a va 2s.c o m public static String join(Collection<String> values, String delimeter) { if (values == null) { return ""; } StringBuilder builder = new StringBuilder(); for (String value : values) { if (builder.length() != 0) { builder.append(delimeter); } builder.append(value); } return builder.toString(); } }