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

ArrayListtoStringClassList(List list)
to String Class List
ArrayList<String> toRet = new ArrayList<String>();
for (Object o : list)
    toRet.add(o.getClass().getSimpleName());
return toRet;
StringtoStringDelimited(final Iterable list, final String delimiter)
Performs a toString on each element given iterable with a given delimiter between elements.
if (list == null) {
    return "null";
final StringBuffer result = new StringBuffer();
final Iterator<?> iterator = list.iterator();
if (iterator.hasNext()) {
    result.append(iterator.next());
while (iterator.hasNext()) {
    result.append(delimiter);
    result.append(iterator.next());
return result.toString();
IntegertoStringItem(List> itemMapList, String subjectName)
to String Item
if (itemMapList != null && itemMapList.size() > 0) { 
    Iterator<Map<String, Object>> iterator = itemMapList.iterator();
    while (iterator.hasNext()) {
        Map<String, Object> next = iterator.next();
        boolean containsValue = next.containsValue(subjectName);
        if (containsValue) {
            return Integer.parseInt(next.get("itemID") + "");
return 0;
StringtoStringList(Collection strings, String separator)
to String List
if (strings != null) {
    final StringBuilder sb = new StringBuilder();
    for (String string : strings) {
        sb.append(separator);
        sb.append(string);
    if (sb.length() > 0) {
        sb.delete(0, separator.length());
...
ListtoStringList(final double[] array)
to String List
List<String> list = new ArrayList<String>(array.length);
for (int i = 0; i < array.length; i++) {
    list.add(String.valueOf(array[i]));
return list;
ListtoStringList(final E[] array)
to String List
List<String> list = new ArrayList<String>(array.length);
for (int i = 0; i < array.length; i++) {
    list.add(array[i].toString());
return list;
ListtoStringList(final List list)
Converts a List of objects to a List of String s.
List<String> ret = new ArrayList<String>();
for (Object o : list) {
    ret.add(o.toString());
return ret;
ListtoStringList(final String tags)
to String List
return tags != null ? Arrays.asList(tags.split("\\s*,\\s*")) : null;
StringtoStringList(HashSet V)
to String List
if ((V == null) || (V.size() == 0)) {
    return "";
final StringBuffer s = new StringBuffer("");
for (final Iterator i = V.iterator(); i.hasNext();)
    s.append(", " + i.next().toString());
if (s.length() == 0)
    return "";
...
ListtoStringList(List list)
to String List
List<String> stringList = new ArrayList<>();
if (list != null) {
    for (Object object : list)
        stringList.add(object != null ? object.toString() : null);
return stringList;