public static String join(String separator,Iterable<?> elements){
  StringBuilder sb=new StringBuilder();
  for (Iterator<?> i=elements.iterator(); i.hasNext(); ) {
    sb.append(i.next());
    if (i.hasNext() && separator != null) {
      sb.append(separator);
    }
  }
  return sb.toString();
}

public static String join ( String separator , Iterable < ? > elements ) { StringBuilder sb = new StringBuilder ( ) ; for ( Iterator < ? > i = elements . iterator ( ) ; i . hasNext ( ) ; ) { sb . append ( i . next ( ) ) ; if ( i . hasNext ( ) && separator != null ) { sb . append ( separator ) ; } } return sb . toString ( ) ; }
joins a collection of elements into a single string value , with a specified separator .
