Here you can find the source of collectionToDelimitedString(Collection
public static String collectionToDelimitedString(Collection<String> values, String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static String collectionToDelimitedString(Collection<String> values, String delimiter) { StringBuffer str = new StringBuffer(); for (String val : values) { if (str.length() > 0) { str.append(delimiter);//from w w w . j av a2 s. c o m } str.append(val); } return str.toString(); } }