Java Utililty Methods Comma Separated List

List of utility methods to do Comma Separated List

Description

The list of methods to do Comma Separated List are organized into topic(s).

Method

ListcommaDelimitedStringToList(String str)
comma Delimited String To List
if (str == null || str.length() == 0) {
    return new ArrayList<String>(0);
List<String> result = new ArrayList<String>();
String[] pieces = str.split(",");
for (String piece : pieces) {
    result.add(piece);
return result;
ListcommaDelimitedToList(String commaDelimited)
comma Delimited To List
List<String> items = Arrays.asList(commaDelimited.split("\\s*,\\s*"));
return items;
Stringcommalist(List l)
commalist
StringBuffer buf = new StringBuffer();
Iterator i = l.iterator();
while (i.hasNext()) {
    buf.append(i.next().toString());
    if (i.hasNext())
        buf.append(',');
return buf.toString();
...
Stringcommalist(List l)
commalist
StringBuffer buf = new StringBuffer();
commalist(l, buf);
return buf.toString();
StringcommandToString(List args)
command To String
StringBuffer buf = new StringBuffer();
for (Iterator<String> i = args.iterator(); i.hasNext();) {
    String arg = i.next();
    if (buf.length() > 0)
        buf.append(' ');
    buf.append(arg);
return buf.toString();
...
StringcommaSeparate(List a_list)
Comma separate all the items in the list.
return delimitList(a_list, 0, a_list.size(), ",");
StringcommaSeparatedClassNames(final List objects)
comma Separated Class Names
final StringBuilder buf = new StringBuilder();
int i = 0;
for (final Object object : objects) {
    if (i++ > 0) {
        buf.append(',');
    buf.append(object.getClass().getName());
return buf.toString();
StringcommaSeparatedList(Collection c)
comma Separated List
StringBuffer text = new StringBuffer();
if (c == null) {
    return "(empty)";
Iterator i = c.iterator();
while (i.hasNext()) {
    Object o = i.next();
    if (text.length() > 0) {
...
StringcommaSeparatedList(Object... values)
creates a comma separated list out of objects in strings
String toAdd = "";
for (int i = 0; i < values.length; i++) {
    if (i == values.length - 1) {
        toAdd += stringify(values[i]);
    } else {
        toAdd += stringify(values[i]) + ", ";
return toAdd;
ListcommaSeparatedList(String string)
Creates a List of String objects from the given comma-separated String.
if (string == null) {
    return null;
List list = new ArrayList();
int index = 0;
while ((index = skipWhitespace(string, index)) < string.length()) {
    int nextIndex;
    if (string.charAt(index) == '\'') {
...