Java Comma Separated List commaSeparatedList(Collection c)

Here you can find the source of commaSeparatedList(Collection c)

Description

comma Separated List

License

Open Source License

Declaration

public static String commaSeparatedList(Collection c) 

Method Source Code

//package com.java2s;

import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static String commaSeparatedList(Collection c) {
        StringBuffer text = new StringBuffer();
        if (c == null) {
            return "(empty)";
        }/*from   w  w  w  .  ja v  a2 s.com*/
        Iterator i = c.iterator();
        while (i.hasNext()) {
            Object o = i.next();
            if (text.length() > 0) {
                text.append(", ");
            }
            text.append(o.toString());
        }
        return text.toString();
    }
}

Related

  1. commalist(List l)
  2. commalist(List l)
  3. commandToString(List args)
  4. commaSeparate(List a_list)
  5. commaSeparatedClassNames(final List objects)
  6. commaSeparatedList(Object... values)
  7. commaSeparatedList(String string)
  8. commaSeparatedString(List items)
  9. commaSeparatedString(List strings)

  10. HOME | Copyright © www.java2s.com 2016