Java Comma Separated List listToString(List list, boolean doCommas)

Here you can find the source of listToString(List list, boolean doCommas)

Description

list To String

License

Open Source License

Declaration

public static String listToString(List<String> list, boolean doCommas) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    public static String listToString(List<String> list, boolean doCommas) {

        StringBuilder sb = new StringBuilder();
        for (String str : list) {
            if (sb.length() > 0) {
                if (doCommas) {
                    sb.append(",");
                }//w  ww . j av  a 2s. c o  m
                sb.append(" ");

            }
            sb.append(str);
        }
        return sb.toString();
    }
}

Related

  1. listToCommandLine(List commands)
  2. listToCommas(List list)
  3. listToCommaSep(List strings)
  4. listToCommaSeparatedList(String prefix, List stringList)
  5. listToCommaSeparatedString(List list)
  6. loadListFromStrings(final String commaDelimitedStrings, final boolean sortList)
  7. moveClasspathArgToEnvironmentVariable(List commandArgs, ProcessBuilder pb)
  8. parseCommaList(String nameCommaList)
  9. parseRsfCommands(List rsfLines, List addItemCommands, List appendEntryCommands)