Java Comma Separated List toCommaSeparatedString(List list)

Here you can find the source of toCommaSeparatedString(List list)

Description

to Comma Separated String

License

Apache License

Declaration

public static String toCommaSeparatedString(List<String> list) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Iterator;
import java.util.List;

public class Main {
    public static String toCommaSeparatedString(List<String> list) {
        return toString(list, ", ");
    }//from  w w w.  j  ava 2  s.  c om

    public static String toString(List<String> list, String delimiter) {
        String argumentString = "";
        Iterator<String> iterator2 = list.iterator();
        for (int i = 0; iterator2.hasNext(); i++) {
            String argument = iterator2.next();
            if (i > 0)
                argumentString += delimiter;
            argumentString += argument;
        }
        return argumentString;
    }
}

Related

  1. stringToList(String commaSeparatedList)
  2. toCommaDelimited(List values)
  3. toCommaList(Collection items)
  4. toCommaSeparated(List list)
  5. toCommaSeparated(List list)
  6. toList(final String commaSeparatedString)
  7. toListDelimitedByComma(String s)
  8. toListOfNonEmptyStringsDelimitedByCommaOrSemicolon(String s)
  9. toListOfStringsDelimitedByCommaOrSemicolon(String s)