Here you can find the source of toString(final Collection> collection)
public static String toString(final Collection<?> collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String toString(final Object[] objects) { if (objects == null) return "null"; final StringBuilder sb = new StringBuilder("{"); boolean isFirst = true; for (final Object object : objects) { if (!isFirst) sb.append(','); else// www . j a v a2 s . c om isFirst = false; sb.append(object); } sb.append('}'); return sb.toString(); } public static String toString(final Collection<?> collection) { if (collection == null) return "null"; final StringBuilder sb = new StringBuilder("{"); boolean isFirst = true; for (final Object object : collection) { if (!isFirst) sb.append(','); else isFirst = false; sb.append(object); } sb.append('}'); return sb.toString(); } }