public static String toString(final Iterable<?> iterable){
  if (iterable instanceof Collection) {
    return iterable.toString();
  }
 else {
    final StringBuilder builder=new StringBuilder();
    boolean firstValue=true;
    builder.append('[');
    for (    final Object value : iterable) {
      if (!firstValue) {
        builder.append(", ");
      }
      builder.append(value);
      firstValue=false;
    }
    builder.append(']');
    return builder.toString();
  }
}

public static String toString ( final Iterable < ? > iterable ) { if ( iterable instanceof Collection ) { return iterable . toString ( ) ; } else { final StringBuilder builder = new StringBuilder ( ) ; boolean firstValue = true ; builder . append ( '[' ) ; for ( final Object value : iterable ) { if ( ! firstValue ) { builder . append ( ", " ) ; } builder . append ( value ) ; firstValue = false ; } builder . append ( ']' ) ; return builder . toString ( ) ; } }
returns a string representation of the provided iterable composed of an opening square bracket , followed by each element separated by commas , and then a closing square bracket .
