Java Comma Separated List toCommaList(Collection items)

Here you can find the source of toCommaList(Collection items)

Description

to Comma List

License

Open Source License

Declaration

public static String toCommaList(Collection<?> items) 

Method Source Code

//package com.java2s;

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static String toCommaList(Collection<?> items) {
        if (items == null || items.size() == 0)
            return (null);

        String itemList = "";

        Iterator<?> it = items.iterator();
        while (it.hasNext()) {
            String item = it.next().toString();
            itemList += item + ",";
        }//from  www  . j a  va 2 s  . c  o  m

        itemList = itemList.substring(0, itemList.length() - 1);
        return (itemList);
    }
}

Related

  1. stringsToCommaString(List strings)
  2. stringToCommaText(List strings)
  3. stringToList(final String commaSeparated)
  4. stringToList(String commaSeparatedList)
  5. toCommaDelimited(List values)
  6. toCommaSeparated(List list)
  7. toCommaSeparated(List list)
  8. toCommaSeparatedString(List list)
  9. toList(final String commaSeparatedString)