code: @Override
      public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
          int prevLength = toAppendTo.length();
          FieldPosition fpos =
                  new FieldPosition(pos.getFieldAttribute(), pos.getField());
          if (obj instanceof Collection) {
              Collection<?> coll = (Collection<?>) obj;
              Measure[] measures = new Measure[coll.size()];
              int idx = 0;
              for (Object o : coll) {
                  if (!(o instanceof Measure)) {
                      throw new IllegalArgumentException(obj.toString());
                  }
                  measures[idx++] = (Measure) o;
              }
              toAppendTo.append(formatMeasures(new StringBuilder(), fpos, measures));
          } else if (obj instanceof Measure[]) {
              toAppendTo.append(formatMeasures(new StringBuilder(), fpos, (Measure[]) obj));
          } else if (obj instanceof Measure){
              toAppendTo.append(formatMeasure((Measure) obj, numberFormat, new StringBuilder(), fpos));
          } else {
              throw new IllegalArgumentException(obj.toString());            
          }
          if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) {
              pos.setBeginIndex(fpos.getBeginIndex() + prevLength);
              pos.setEndIndex(fpos.getEndIndex() + prevLength);
          }
          return toAppendTo;
      }
docs: Able to format Collection&lt;? extends Measure&gt;, Measure[], and Measure
  by delegating to formatMeasures.
  If the pos argument identifies a NumberFormat field,
  then its indices are set to the beginning and end of the first such field
  encountered. MeasureFormat itself does not supply any fields.
  
  Calling a
  <code>formatMeasures</code> method is preferred over calling
  this method as they give better performance.
  
  @param obj must be a Collection&lt;? extends Measure&gt;, Measure[], or Measure object.
  @param toAppendTo Formatted string appended here.
  @param pos Identifies a field in the formatted text.
  @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)