Here you can find the source of toString(List> list)
public static String toString(List<?> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String toString(List<?> list) { StringBuilder builder = new StringBuilder(); boolean first = true; builder.append("["); for (Object o : list) { if (first) { first = false;/*w w w . jav a 2s .c o m*/ } else { builder.append(", "); } builder.append(o); } builder.append("]"); return builder.toString(); } }