Java Comma Separated List listToCommaSeparatedList(String prefix, List stringList)

Here you can find the source of listToCommaSeparatedList(String prefix, List stringList)

Description

list To Comma Separated List

License

Open Source License

Declaration

public static String listToCommaSeparatedList(String prefix, List<String> stringList) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    public static String listToCommaSeparatedList(String prefix, List<String> stringList) {

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(prefix);//from   w  w  w.  j  ava  2 s .c om

        for (int i = 0; i < stringList.size(); i++) {
            stringBuilder.append(stringList.get(i));

            if ((i + 1) < stringList.size())
                stringBuilder.append(",");
        }

        return stringBuilder.toString();
    }
}

Related

  1. implodeCommaAnd(List list, String comma, String and)
  2. listToComma(List list)
  3. listToCommandLine(List commands)
  4. listToCommas(List list)
  5. listToCommaSep(List strings)
  6. listToCommaSeparatedString(List list)
  7. listToString(List list, boolean doCommas)
  8. loadListFromStrings(final String commaDelimitedStrings, final boolean sortList)
  9. moveClasspathArgToEnvironmentVariable(List commandArgs, ProcessBuilder pb)