Here you can find the source of toString(final Collection> objs)
Parameter | Description |
---|---|
objs | the objects |
public static String toString(final Collection<?> objs)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { /**/*w w w .j a v a 2 s .c om*/ * Converts an array of objects to a comma separated string * * @param objs the objects * @return a comma separated string */ public static String toString(final Collection<?> objs) { return objs != null ? toString(objs.toArray()) : toString(new Object[] {}); } /** * Converts an array of objects to a comma separated string * * @param objs the objects * @return a comma separated string */ public static String toString(final Object[] objs) { final StringBuilder sb = new StringBuilder(); sb.append('['); if (objs != null) { int i = 0; for (final Object obj : objs) { sb.append(obj.toString()); if (i < (objs.length - 1)) { sb.append(','); } i++; } } sb.append(']'); return sb.toString(); } }