Here you can find the source of toString(Collection objects)
public static String toString(Collection objects)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static String toString(Collection objects) { String string = ""; for (Object object : objects) { string = string + object.toString() + ", "; }//from ww w .j ava 2 s . co m try { string = string.substring(0, string.length() - 2); } catch (StringIndexOutOfBoundsException sioobe) { return ""; } return string; } }