public static String toCommaDelimitedString(Collection c){
  if (c.isEmpty()) {
    throw new IllegalArgumentException();
  }
  StringBuffer result=new StringBuffer();
  for (Iterator i=c.iterator(); i.hasNext(); ) {
    Object o=i.next();
    result.append(", " + o.toString());
  }
  return result.substring(1);
}

public static String toCommaDelimitedString ( Collection c ) { if ( c . isEmpty ( ) ) { throw new IllegalArgumentException ( ) ; } StringBuffer result = new StringBuffer ( ) ; for ( Iterator i = c . iterator ( ) ; i . hasNext ( ) ; ) { Object o = i . next ( ) ; result . append ( ", " + o . toString ( ) ) ; } return result . substring ( 1 ) ; }
returns the elements of c separated by commas . c must not be empty .
