Here you can find the source of toString(List> list)
static String toString(List<?> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { static String toString(List<?> list) { if (list == null) return "null"; StringBuilder sb = new StringBuilder(); sb.append('['); for (Object element : list) { sb.append(element);// w w w . j av a 2 s .co m sb.append(','); } sb.setLength(sb.length() - 1); sb.append(']'); return sb.toString(); } }