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

StringcommaSeparatedString(List items)
Iterates over a list of strings and appends them.
StringBuilder sb = new StringBuilder();
String sep = "";
for (String item : items) {
    sb.append(sep);
    sb.append(item);
    sep = ",";
return sb.toString();
...
StringcommaSeparatedString(List strings)
comma Separated String
String mainString = "";
for (String string : strings)
    mainString += "," + string;
mainString.replaceFirst(",", "");
return mainString;
ListcommaSeparatedStringToList(String csvListStr)
comma Separated String To List
List<String> list = new ArrayList<String>();
if (csvListStr != null && csvListStr.trim().length() > 0) {
    String[] ignoreListArr = csvListStr.split(",");
    for (int i = 0; i < ignoreListArr.length; i++) {
        list.add(ignoreListArr[i]);
return list;
...
ListcommaSeparatedToList(String str)
comma Separated To List
if (str == null) {
    return new ArrayList<>();
return Arrays.asList(str.split("\\s*,\\s*"));
ListcommaSeperatedStringToList(String strValue)
comma Seperated String To List
if (strValue != null && !strValue.isEmpty()) {
    return Arrays.asList(strValue.split("\\s*,\\s*"));
return new ArrayList<>();
ListcommaSepLineToList(String commSepLine)
Comma sep line to list.
List<String> retList = null;
if (commSepLine != null) {
    String[] calls = commSepLine.split(",");
    if (calls != null) {
        retList = new ArrayList<String>();
        for (String call : calls) {
            retList.add(call.trim());
return retList;
ListcommaStringToList(String inputString)
comma String To List
return Arrays.asList(inputString.split("\\s*,\\s*"));
ListconvertCommaDelimitedStringToList(String s)
convert Comma Delimited String To List
List result = null;
if (s != null) {
    result = new ArrayList();
    String[] valueArray = s.split(",");
    for (int i = 0; i < valueArray.length; i++) {
        String value = valueArray[i];
        if (value != null) {
            value = value.trim();
...
StringConvertDiscussionGroupListToCommaString(List list)
Convert Discussion Group List To Comma String
String s = "";
if (list != null) {
    for (Long l : list) {
        if (s.length() > 0)
            s += ",";
        s += "" + l;
return s;
ListconvertToStringList(String valuesCommaSeparated)
Convert a String List.
List<String> stringValues = new ArrayList<>();
if (valuesCommaSeparated != null) {
    for (String value : valuesCommaSeparated.split(",")) {
        if (!isBlank(value)) {
            stringValues.add(value);
return stringValues;