Java List to String listToString(Iterable list)

Here you can find the source of listToString(Iterable list)

Description

list To String

License

Apache License

Declaration

public static String listToString(Iterable<?> list) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Iterator;

public class Main {
    public static String listToString(Iterable<?> list) {
        if (list == null) {
            return "";
        }/*from   w ww .  j  a  v  a 2 s.c om*/
        StringBuilder str = new StringBuilder();
        for (Iterator<?> it = list.iterator(); it.hasNext();) {
            Object o = it.next();
            str.append(o);
            if (it.hasNext()) {
                str.append(", ");
            }
        }
        return str.toString();
    }
}

Related

  1. listToString(Collection col)
  2. listToString(Collection l)
  3. listToString(final List list, final String separator)
  4. listToString(final List list)
  5. listToString(final List stringList)
  6. listToString(List a, String separator)
  7. listToString(List inList, String delimeter)
  8. listToString(List l)
  9. listToString(List l)