Here you can find the source of printCollection(Collection c)
Parameter | Description |
---|---|
c | a parameter |
public static String printCollection(Collection c)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { /**/*from ww w .java 2s. c om*/ * Utility method to print a collection. * @param c * @return String */ public static String printCollection(Collection c) { if (c != null) { StringBuffer sb = new StringBuffer("["); Iterator itr = c.iterator(); while (itr.hasNext()) { sb.append(itr.next()); if (itr.hasNext()) { sb.append(", "); } } sb.append("]"); return sb.toString(); } else { return "[null]"; } } }