Android Utililty Methods List to String Convert

List of utility methods to do List to String Convert

Description

The list of methods to do List to String Convert are organized into topic(s).

Method

StringlistLongToString(List inputList)
list -> String list:100,200,300 - > string:100,200,300
if (null == inputList || inputList.isEmpty()) {
    return "";
StringBuffer sb = new StringBuffer();
for (Long input : inputList) {
    sb.append(input);
    sb.append(COMMA);
sb.setLength(sb.length() - 1);
return sb.toString();
StringlistStrToString(List inputList)
list -> String list:100,200,300 - > string:100,200,300
if (null == inputList || inputList.isEmpty()) {
    return "";
StringBuffer sb = new StringBuffer();
for (String input : inputList) {
    sb.append(input);
    sb.append(COMMA);
sb.setLength(sb.length() - 1);
return sb.toString();
StringlistToString(List list)
list To String
StringBuilder sb = new StringBuilder();
if (list != null && list.size() > 0) {
    for (int i = 0; i < list.size(); i++) {
        if (i < list.size() - 1) {
            sb.append(list.get(i) + ",");
        } else {
            sb.append(list.get(i));
return sb.toString();
StringconvertStringArrayToString( List stringList, String seperator)
convert String Array To String
String value = "";
for (int i = 0; i < stringList.size(); i++) {
    String selectedItemValue = stringList.get(i);
    if (i != 0) {
        value += seperator + " ";
    value += selectedItemValue;
return value;
StringlistToString(List list, String delimiter)
list To String
if (list == null || list.isEmpty()) {
    return "";
final StringBuilder builder = new StringBuilder();
boolean first = true;
for (String s : list) {
    if (first) {
        first = false;
...
StringgetCommaDelimitedString(List input)
Returns a comma delimited String from input list of strings.
String output = "";
if (input != null && input.size() > 0) {
    for (String tag : input) {
        output += tag + ",";
    output = output.substring(0, output.length() - 1);
    output = output.replaceAll(" ", "");
return output;