Here you can find the source of listToString(Collection extends Object> collection)
public static String listToString(Collection<? extends Object> collection)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static String listToString(Collection<? extends Object> collection) { StringBuilder out = new StringBuilder(); out.append("["); for (Object o : collection) { out.append(String.format("%s ", o)); }//ww w .j av a 2s. c o m out.append("]"); return out.toString(); } }