Java Utililty Methods List to String

List of utility methods to do List to String

Description

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

Method

StringlistToString(List list)
Trims items in the list.
StringBuilder buff = new StringBuilder();
for (String item : list) {
    buff.append(item.trim()).append(",");
int len = buff.length() - 1;
buff.delete(len, len);
return buff.toString();
StringlistToString(List list, String delimiter)
list To String
String ret = "";
for (int i = 0; i < list.size(); i++) {
    if (i < list.size() - 1) {
        ret += list.get(i) + delimiter;
    } else {
        ret += list.get(i);
return ret;
StringlistToString(List list, String expr)
list To String
String strInfo = "";
if (list != null && list.size() > 0) {
    StringBuffer sf = new StringBuffer();
    for (String str : list) {
        sf.append(str);
        sf.append(expr);
    strInfo = sf.substring(0, sf.length() - 1);
...
StringlistToString(List list, String separator)
list To String
if (list.isEmpty()) {
    return "";
int n = list.size();
StringBuilder sb = new StringBuilder();
sb.append(list.get(0));
if (n == 1) {
    return sb.toString();
...
StringlistToString(List list, String separator)
list To String
if (list.isEmpty()) {
    return "";
int n = list.size();
StringBuilder sb = new StringBuilder();
sb.append(list.get(0));
if (n == 1) {
    return sb.toString();
...
StringlistToString(List list, String separator)
list To String
StringBuilder strBuilder = new StringBuilder();
boolean notFirst = false;
for (String element : list) {
    if (element == null || element.trim().length() == 0) {
        continue;
    if (notFirst) {
        strBuilder.append(separator);
...
StringlistToString(List list, String split)
list To String
StringBuilder sb = new StringBuilder();
if (!isEmpty(list)) {
    for (int i = 0; i < list.size(); i++) {
        if (i < list.size() - 1) {
            sb.append(list.get(i) + split);
        } else {
            sb.append(list.get(i));
return sb.toString();
StringlistToString(List params, String sepator)
list To String
if (params.size() > 0) {
    StringBuffer buffer = new StringBuffer();
    for (String string : params) {
        buffer.append(string + sepator);
    String result = buffer.toString();
    return result.substring(0, result.length() - 1);
} else {
...
StringlistToString(List pListToConvert)
list To String
return listToString(pListToConvert, ",");
StringlistToString(List queryList, String delimitedString)
List to string.
String newString = "";
for (Iterator<String> it = queryList.iterator(); it.hasNext();) {
    newString += it.next();
    if (it.hasNext()) {
        newString += delimitedString;
return newString;
...