Here you can find the source of toString(final Collection> collection)
public final static String toString(final Collection<?> collection)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public final static String toString(final Collection<?> collection) { if (collection == null) { return "null"; }//from w w w .j a v a 2 s . c o m final StringBuilder s = new StringBuilder(); for (final Iterator<?> i = collection.iterator(); i.hasNext();) { s.append(String.valueOf(i.next())); if (i.hasNext()) { s.append(", "); } } return s.toString(); } }