List of utility methods to do Collection to String
String | collectionToString(Collection extends Object> list, String delimiter) collection To String if (list.size() == 0) { return ""; StringBuilder output = new StringBuilder(); for (Object element : list) { output.append(element.toString()).append(delimiter); String outputStr = output.toString(); ... |
String | collectionToString(Collection> c) collection To String return c.toString();
|
String | collectionToString(Collection> c) collection To String StringBuilder sb = new StringBuilder("["); Iterator<?> i = c.iterator(); while (i.hasNext()) { Object o = i.next(); if (o == null) sb.append("null"); else if (o == c) sb.append("(this Collection)"); ... |
String | collectionToString(Collection> c) An implementation of Collection.toString() suitable for classes with locks. final Object[] a = c.toArray(); final int size = a.length; if (size == 0) return "[]"; int charLength = 0; for (int i = 0; i < size; i++) { Object e = a[i]; String s = (e == c) ? "(this Collection)" : objectToString(e); ... |
String | collectionToString(Collection> c) Transforms a collection to a string representation as same as use of method collectionToString(c, null) return collectionToString(c, null);
|
String | collectionToString(Collection> c, String separator) collection To String Iterator<?> i = c.iterator(); StringBuffer sb = new StringBuffer(); boolean isNext = false; while (i.hasNext()) { if (isNext) { sb.append(separator); } else { isNext = true; ... |
String | collectionToString(Collection> coll, String connectSymbol) collection To String return collectionToString(coll, connectSymbol, "", ""); |
String | collectionToString(Collection> collection, String separator) collection To String StringBuilder sb = new StringBuilder(); for (Object o : collection) { sb.append(o.toString()); if (separator != null) { sb.append(separator); if (sb.length() >= separator.length()) { ... |
String | collectionToString(Collection> collection, String separator) collection To String if (collection == null || collection.size() == 0) { return ""; StringBuffer s = new StringBuffer(32 * collection.size()); Iterator<?> i = collection.iterator(); s.append(i.next()); while (i.hasNext()) { s.append(separator).append(i.next()); ... |
String | collectionToString(Collection> elements) Converts the specified Collection to a string. if (elements == null) { return NULL_STR; int size = elements.size(); if (size == 0) { return "[]"; } else if (size == 1) { return "[" + elements.toArray()[0] + "]"; ... |