List of utility methods to do Collection to String
String | collectionToString(Collection c, String delim) collection To String StringBuffer sb = new StringBuffer(); for (Iterator i = c.iterator(); i.hasNext();) { if (sb.length() > 0) { sb.append(delim); Object o = i.next(); if (o != null) { sb.append(o.toString()); ... |
String | collectionToString(Collection c, String spilt) Formats a Date as a fifteen character long String made up of the Date's padded millisecond value. if (c == null) { return null; if (spilt == null) { return null; String ret = ""; ArrayList a = new ArrayList(c); ... |
String | collectionToString(Collection col) Prints each object in the collection with commas between them. StringBuffer outputString = new StringBuffer(100); boolean firstItem = true; Iterator it = col.iterator(); while (it.hasNext()) { if (!firstItem) outputString.append(", "); outputString.append(it.next()); firstItem = false; ... |
String | collectionToString(Collection coll) Converts the given collection of objects to string as a comma-separated list. if (coll == null) { return "<null>"; } else if (coll.isEmpty()) { return "<none>"; } else { StringBuilder s = new StringBuilder(); Iterator iter = coll.iterator(); while (iter.hasNext()) { ... |
String | collectionToString(Collection collection, String delim) collection To String if (collection == null) { return "NULL"; Iterator i = collection.iterator(); return iteratorToString(i, delim, null); |
String | collectionToString(Collection list, String split) collection To String if (isEmpty(split)) { split = ", "; StringBuilder buf = new StringBuilder(); if (list != null && !list.isEmpty()) { Iterator iter = list.iterator(); if (iter.hasNext()) { buf.append(iter.next()); ... |
String | collectionToString(Collection set) collection To String return collectionToString(set, ","); |
String | collectionToString(Collection extends Object> c) collection To String return arrayToString(c.toArray());
|
String | collectionToString(Collection extends Object> collection, String delimiter) Converts all the objects from the collections to a string and separates them using a delimiter. StringBuilder result = new StringBuilder(); List<Object> list = new ArrayList<>(); list.addAll(collection); if (delimiter == null) { delimiter = ","; for (Object obj : list) { result.append(obj.toString()); ... |
String | collectionToString(Collection extends Object> collection, String seperator) collection To String String result = ""; for (Iterator<? extends Object> iterator = collection.iterator(); iterator.hasNext();) { String string = iterator.next().toString(); if (result.length() == 0) result += string; else result += seperator + string; return result; |