public static String toString(Collection<?> collection,String separator){
  boolean first=true;
  StringBuilder b=new StringBuilder();
  for (  Object o : collection) {
    if (first) {
      first=false;
    }
 else {
      b.append(separator);
    }
    b.append(o);
  }
  return b.toString();
}

public static String toString ( Collection < ? > collection , String separator ) { boolean first = true ; StringBuilder b = new StringBuilder ( ) ; for ( Object o : collection ) { if ( first ) { first = false ; } else { b . append ( separator ) ; } b . append ( o ) ; } return b . toString ( ) ; }
returns a string containing the tostring ( ) - representation of the elements of collection , separated by the given separator .
