Here you can find the source of printCollection(Collection l)
public static String printCollection(Collection l)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static String printCollection(Collection l) { return printCollection(l, ""); }/*from w w w . j a v a2 s .com*/ public static String printCollection(Collection l, String indent) { if (l == null) { return indent + "(null)"; } if (l.isEmpty()) { return indent + "(empty collection)"; } StringBuilder result = new StringBuilder(); for (Object o : l) { result.append(indent).append(o).append("\n"); } result.deleteCharAt(result.length() - 1); return result.toString(); } }