Java Utililty Methods Comma Separated List

List of utility methods to do Comma Separated List

Description

The list of methods to do Comma Separated List are organized into topic(s).

Method

doubleresolveCommandParam(List params, String name, double defaultValue)
resolve Command Param
String v = resolveCommandParam(params, name, null);
return v == null ? defaultValue : Double.parseDouble(v);
ArrayListsplitCommandsToList(String row, String delimiter)
Splits commands to list with given delimiter.
ArrayList<String> returnCommands = new ArrayList<String>();
if (row == null || row.trim().equals(""))
    return returnCommands;
try {
    String[] split = row.split(delimiter);
    for (String command : split) {
        returnCommands.add(command);
} catch (Exception e) {
    System.out.println("Error splitting commands to list: " + e);
    e.printStackTrace();
return returnCommands;
StringsplitListByComma(List hosts)
Split list by comma.
boolean firstHost = true;
StringBuilder hostConnection = new StringBuilder();
for (String host : hosts) {
    if (!firstHost) {
        hostConnection.append(",");
    hostConnection.append(host.trim());
    firstHost = false;
...
StringsplitListWithComma(List StringList)
split List With Comma
StringBuffer strOfList = new StringBuffer("");
for (int i = 0; i < StringList.size(); i++) {
    if (i != 0) {
        strOfList.append(",");
    strOfList.append(StringList.get(i).toString());
return strOfList.toString();
...
ListsplitOnCommas(final String commaSeparatedList)
split On Commas
if (commaSeparatedList == null) {
    return null;
final String removeLeadingWhiteSpace = removeLeadingWhiteSpace(commaSeparatedList);
if (removeLeadingWhiteSpace.length() == 0) {
    return Collections.emptyList();
final String[] splitAsArray = removeLeadingWhiteSpace.split("\\W*,\\W*");
...
StringstringListStringWithoutBracketsCommaSeparated(List list)
string List String Without Brackets Comma Separated
return stringListStringWithoutBracketsWithSpecifiedSeparator(list, ",");
StringstringsToCommaString(List strings)
Takes a list of strings and joins them with a comma.
return stringsToString(strings, ",");
StringstringToCommaText(List strings)
string To Comma Text
String text = "";
if (strings.size() > 0) {
    for (String s : strings) {
        if (text.length() > 0) {
            text = text + ", ";
        text = text + "cpgf::" + s;
return text;
ListstringToList(final String commaSeparated)
string To List
return appendDelimitedStringToList(commaSeparated, new ArrayList<String>());
ListstringToList(String commaSeparatedList)
string To List
ArrayList<String> list = new ArrayList<String>();
String[] preprocessedList = commaSeparatedList.split(",");
for (String string : preprocessedList) {
    list.add(string.trim());
return list;