List of utility methods to do Collection to String
String | toString(Collection to String StringBuilder stringBuilder = new StringBuilder("["); boolean first = true; for (T t : collection) { if (!first) { stringBuilder.append(','); } else { first = true; if (t == null) { stringBuilder.append("null"); } else { stringBuilder.append(t.toString()); stringBuilder.append(']'); return stringBuilder.toString(); |
Collection | toString(Collection Returns a String representation of the input collection by calling each element's toString() method. Collection<String> strings = new ArrayList<String>(); for (T item : collection) strings.add(item.toString()); return strings; |
String | toString(Collection Converts the collection into a comma-delimited list, Use #toString(Collection,String) if you need a different delimiter. return toString(collection, ","); |
String | toString(Collection to String StringBuilder sb = new StringBuilder(); boolean first = true; for (T object : collection) { if (first == false) { sb.append(divider); first = false; sb.append(toString(object, divider)); ... |
String | toString(Collection to String StringBuilder sb = new StringBuilder(); for (T obj : list) { if (sb.length() > 0 && delimeter != null) { sb.append(delimeter); sb.append(obj); return sb.toString(); ... |
String | toString(final Collection> collection) to String if (collection == null) return "null"; final StringBuilder sb = new StringBuilder("{"); boolean isFirst = true; for (final Object object : collection) { if (!isFirst) sb.append(','); else ... |
String | toString(final Collection> collection) to String if (collection == null) { return "null"; final StringBuilder s = new StringBuilder(); for (final Iterator<?> i = collection.iterator(); i.hasNext();) { s.append(String.valueOf(i.next())); if (i.hasNext()) { s.append(", "); ... |
String | toString(final Collection> collection, final String separator) Create a textual representation of the given collection, separating the individual elements by the provided separator. if (collection == null || collection.isEmpty()) { return ""; if (separator == null) { return collection.toString(); final StringBuilder builder = new StringBuilder(collection.size() * (16 + separator.length())); boolean addSeparator = false; ... |
String | toString(final Collection> objs) Converts an array of objects to a comma separated string return objs != null ? toString(objs.toArray()) : toString(new Object[] {}); |
String | toString(final Collection> values) to String final StringBuilder builder = new StringBuilder(); for (Object value : values) { builder.append(value); builder.append(COLLECTION_SEPARATOR); if (values.size() > 0) { builder.setLength(builder.length() - COLLECTION_SEPARATOR_LENGTH); return builder.toString(); |