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

ListaddExecutableForBatchFile(List command)
add Executable For Batch File
String name = command.get(0).toLowerCase();
if (name.endsWith(".bat") || name.endsWith(".cmd")) {
    List<String> newCommand = new ArrayList<String>(command.size() + 2);
    newCommand.add("cmd.exe");
    newCommand.add("/C");
    newCommand.addAll(command);
    return newCommand;
return command;
voidaddItemFromCommaStrings(final List list, final String commaStrings)
add Item From Comma Strings
for (final String str : commaStrings.split(",")) {
    list.add(str);
voidaddJvmArgumentsAndOptions(final List commandLine, final String[] jvmArgsOpts)
add Jvm Arguments And Options
if (jvmArgsOpts != null) {
    commandLine.addAll(Arrays.asList(jvmArgsOpts));
voidaddMultiLine(String multiLine, List commandsList)
Split a string into separate lines and add them to the list.
if (!multiLine.isEmpty()) {
    String[] commandsStr = multiLine.split("\\r?\\n"); 
    for (String str : commandsStr) {
        str = str.trim();
        if (str.length() > 0) {
            commandsList.add(str);
voidaddPropertyToCommand(List command, String key, String value)
Utility method to add a property to the command of Sonar Runner The Runner requires that the -D flag and the property are two cli arguments
command.add(1, String.format("%s=%s", key, value));
command.add(1, "-D");
String[]commaDelimitedListToStringArray(final String str)
comma Delimited List To String Array
return delimitedListToStringArray(str, ",");
String[]commaDelimitedListToStringArray(String str)
comma Delimited List To String Array
return delimitedListToStringArray(str, ",");
String[]commaDelimitedListToStringArray(String str)
comma Delimited List To String Array
return delimitedListToStringArray(str, ",");
String[]commaDelimitedListToStringArray(String str)
Convert a CSV list into an array of Strings.
return delimitedListToStringArray(str, ",");
String[]commaDelimitedListToStringArray(String str)
comma Delimited List To String Array
return delimitedListToStringArray(str, ",");