code: public static String listToString (Object val, Formatter formatter)
      {
          StringBuilder buf = new StringBuilder();
          listToString(buf, val, formatter);
          return buf.toString();
      }
docs: Formats a collection of elements (either an array of objects, an {@link Iterator}, an {@link
  Iterable} or an {@link Enumeration}) using the supplied formatter on each element. Note
  that if you simply wish to format a collection of elements by calling {@link
  Object#toString} on each element, you can just pass the list to the {@link
  #toString(Object)} method which will do just that.