public static <T>String toString(Collection<T> collection){
  if (collection == null) {
    return "null";
  }
  if (collection.isEmpty()) {
    return "";
  }
  StringBuilder buf=new StringBuilder();
  String delimiter="";
  for (  T t : collection) {
    if (t == null) {
      continue;
    }
    buf.append(delimiter);
    buf.append(t);
    delimiter=", ";
  }
  return buf.toString();
}

public static < T > String toString ( Collection < T > collection ) { if ( collection == null ) { return "null" ; } if ( collection . isEmpty ( ) ) { return "" ; } StringBuilder buf = new StringBuilder ( ) ; String delimiter = "" ; for ( T t : collection ) { if ( t == null ) { continue ; } buf . append ( delimiter ) ; buf . append ( t ) ; delimiter = ", " ; } return buf . toString ( ) ; }
returns a list of the elements invoking tostring on non - null elements .
