List of utility methods to do Collection Convert
String | toSeparatedString(Collection extends Object> items, String separator) Convert a collection of items to a string separated by a specified string return toSeparatedString(items.toArray(new Object[items.size()]), separator); |
String | toSeperatedString(final Collection to Seperated String final StringBuffer stringBuffer = new StringBuffer(); for (final T element : list) { if (stringBuffer.length() != 0) stringBuffer.append(","); stringBuffer.append(element.toString()); return stringBuffer.toString(); |
Set | toSet(Collection to Set return asSet(c);
|
T | toSingleton(Collection to Singleton return toSingleton(l.iterator());
|
String | toSQLIn(Collection to SQL In if (values == null || values.isEmpty()) return null; String[] strvalues = new String[0]; strvalues = (String[]) values.toArray(new String[values.size()]); return toSQLIn(strvalues); |
StringBuilder | toStringBuilder(Collection extends Object> collection, String delimiter) Transform a collection of objects to a delimited String. StringBuilder sb = new StringBuilder(collection.size() * 20); for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) { Object cs = it.next(); sb.append(cs); if (it.hasNext()) { sb.append(delimiter); return sb; |
List | toStringColl(Collection> set) to String Coll List<String> list = new ArrayList<String>(); toStringColl(list, set); return list; |
String | toSV(Collection collection, String separator) to SV if (collection == null) { return null; StringBuilder sb = new StringBuilder(); Iterator itr = collection.iterator(); while (itr.hasNext()) { sb.append(itr.next()); if (itr.hasNext()) { ... |
Object[][] | toTestParameters(Collection> rawParams) to Test Parameters Object[][] testParams = new Object[rawParams.size()][]; int counter = 0; for (Object curRawParam : rawParams) testParams[counter++] = new Object[] { curRawParam }; return testParams; |
String | toToolTip(final Collection> collection) to Tool Tip if (collection == null || collection.size() == 0) { return null; final String START_SEPARATOR = "<p>"; final String END_SEPARATOR = "</p>"; final StringBuffer buffer = new StringBuffer("<html>"); for (Iterator<?> iterator = collection.iterator(); iterator.hasNext();) { buffer.append(START_SEPARATOR); ... |