public static String iterableToCommaSeparatedList(Iterable<?> iterable){
  StringBuilder builder=new StringBuilder();
  boolean first=true;
  for (  Object obj : iterable) {
    if (first) {
      builder.append(String.format("%s",obj.toString()));
      first=false;
    }
 else {
      builder.append(String.format(", %s",obj.toString()));
    }
  }
  return builder.toString();
}

public static String iterableToCommaSeparatedList ( Iterable < ? > iterable ) { StringBuilder builder = new StringBuilder ( ) ; boolean first = true ; for ( Object obj : iterable ) { if ( first ) { builder . append ( String . format ( "%s" , obj . toString ( ) ) ) ; first = false ; } else { builder . append ( String . format ( ", %s" , obj . toString ( ) ) ) ; } } return builder . toString ( ) ; }
this method will format any iterable class into a comma - separated list .
