People often are keen to remove the square brackets that begin and end Java's implementation of List.toString, e.g. [ a, b, c ] so you can use the below not only to do that, but to choose your own prefix, suffix and delimiter. The code is HERE
package net.proteanit.util;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Random;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Description of the Class
*
* @author CEHJ
* @created 10 March 2004
*/
public class StringUtils {
+--617 lines: public static final String HEXCHARS = "0123456789abcdef";
/**
*
* @param list The List to be represented as a String
* @param header The String prepended to the String representation
* @param separator The String separating each List element
* @param footer The String appended to the String representation
*
* @return The String representation of the List
*/
public static String listToString(List<?extends Object> list,
String header, String separator, String footer) {
String delim = "";
StringBuilder sb = new StringBuilder(header);
for (int i = 0; i < list.size(); i++) {
sb.append(delim).append("" + list.get(i));
delim = separator;
}
return sb.append(footer).toString();
}
+--139 lines: *
}
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Random;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Description of the Class
*
* @author CEHJ
* @created 10 March 2004
*/
public class StringUtils {
+--617 lines: public static final String HEXCHARS = "0123456789abcdef";
/**
*
* @param list The List to be represented as a String
* @param header The String prepended to the String representation
* @param separator The String separating each List element
* @param footer The String appended to the String representation
*
* @return The String representation of the List
*/
public static String listToString(List<?extends Object> list,
String header, String separator, String footer) {
String delim = "";
StringBuilder sb = new StringBuilder(header);
for (int i = 0; i < list.size(); i++) {
sb.append(delim).append("" + list.get(i));
delim = separator;
}
return sb.append(footer).toString();
}
+--139 lines: *
}