Here you can find the source of collectionToString(final String separator, final Collection> coll)
public static String collectionToString(final String separator, final Collection<?> coll)
//package com.java2s; /*/*from w w w .j a v a2s . c om*/ * (c) 2009-2012 Julien Rialland, and the jFastCGI project developers. * Released under BSD License, see LICENSE_JRIALLAND.txt */ import java.util.Collection; import java.util.Iterator; public class Main { public static String collectionToString(final String separator, final Collection<?> coll) { final StringBuffer buf = new StringBuffer(); final Iterator<?> it = coll.iterator(); while (it.hasNext()) { final Object item = it.next(); if (item == null) { buf.append("null"); } else { buf.append(item.toString()); } if (it.hasNext()) { buf.append(separator); } } return buf.toString(); } }