List of utility methods to do Comma Separated List
String | listToCommandLine(List list To Command Line String arguments = ""; for (String command : commands) { arguments += command; arguments += " "; if (arguments.length() > 0) arguments = arguments.substring(0, arguments.length() - 1); return arguments; ... |
String | listToCommas(List Inserts a commas between each word in the given string with StringBuilder. StringBuilder builder = new StringBuilder(); for (int i = 0; i < list.size(); i++) { String string = list.get(i); if ((i + 1) == list.size()) { builder.append(string); } else builder.append(string + ", "); return builder.toString().trim(); |
String | listToCommaSep(List list To Comma Sep if (strings.isEmpty()) return "&bNone"; StringBuilder sb = new StringBuilder(); strings.forEach(s -> sb.append("&3").append(s).append("&7, ")); return sb.delete(sb.length() - 2, sb.length()).toString(); |
String | listToCommaSeparatedList(String prefix, List list To Comma Separated List StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(prefix); for (int i = 0; i < stringList.size(); i++) { stringBuilder.append(stringList.get(i)); if ((i + 1) < stringList.size()) stringBuilder.append(","); return stringBuilder.toString(); ... |
String | listToCommaSeparatedString(List list To Comma Separated String if (list == null) { return null; StringBuffer result = new StringBuffer(); for (int i = 0; i < list.size(); i++) { result.append(list.get(i) + (i == list.size() - 1 ? "" : ", ")); return result.toString(); ... |
String | listToString(List list To String StringBuilder sb = new StringBuilder(); for (String str : list) { if (sb.length() > 0) { if (doCommas) { sb.append(","); sb.append(" "); sb.append(str); return sb.toString(); |
ArrayList | loadListFromStrings(final String commaDelimitedStrings, final boolean sortList) Converts a string containing a comma-delimited list of values into a List containing those values.
return loadListFromStrings(null, commaDelimitedStrings, sortList);
|
void | moveClasspathArgToEnvironmentVariable(List move Classpath Arg To Environment Variable int cpFlagIndex = commandArgs.indexOf("-cp"); if (cpFlagIndex == -1) { cpFlagIndex = commandArgs.indexOf("-classpath"); if (cpFlagIndex > -1 && cpFlagIndex < commandArgs.size() - 1) { Map<String, String> env = pb.environment(); String classpath = commandArgs.get(cpFlagIndex + 1); env.put("CLASSPATH", classpath); ... |
List | parseCommaList(String nameCommaList) Parses a comma-separated list. if (nameCommaList.equals("")) { return Collections.emptyList(); if (nameCommaList.endsWith(",")) { final String zzz = "zzz"; final List<String> list = parseCommaList(nameCommaList + zzz); String last = list.get(list.size() - 1); if (last.equals(zzz)) { ... |
void | parseRsfCommands(List parse Rsf Commands rsfLines.stream().forEach(command -> { if (command.startsWith("add-item")) { addItemCommands.add(command); } else if (command.startsWith("append-entry")) { appendEntryCommands.add(command); }); |