public <A extends Appendable> A appendTo(
     A paramA, Iterator<? extends Map.Entry<?, ?>> paramIterator) throws IOException {
   Preconditions.checkNotNull(paramA);
   if (paramIterator.hasNext()) {
     Map.Entry localEntry = (Map.Entry) paramIterator.next();
     paramA.append(joiner.toString(localEntry.getKey()));
     paramA.append(keyValueSeparator);
     paramA.append(joiner.toString(localEntry.getValue()));
     while (paramIterator.hasNext()) {
       paramA.append(joiner.separator);
       localEntry = (Map.Entry) paramIterator.next();
       paramA.append(joiner.toString(localEntry.getKey()));
       paramA.append(keyValueSeparator);
       paramA.append(joiner.toString(localEntry.getValue()));
     }
   }
   return paramA;
 }
Ejemplo n.º 2
0
 /**
  * Appends the string representation of each entry in {@code entries}, using the previously
  * configured separator and key-value separator, to {@code appendable}.
  *
  * @since 11.0
  */
 @Beta
 public <A extends Appendable> A appendTo(A appendable, Iterator<? extends Entry<?, ?>> parts)
     throws IOException {
   checkNotNull(appendable);
   if (parts.hasNext()) {
     Entry<?, ?> entry = parts.next();
     appendable.append(joiner.toString(entry.getKey()));
     appendable.append(keyValueSeparator);
     appendable.append(joiner.toString(entry.getValue()));
     while (parts.hasNext()) {
       appendable.append(joiner.separator);
       Entry<?, ?> e = parts.next();
       appendable.append(joiner.toString(e.getKey()));
       appendable.append(keyValueSeparator);
       appendable.append(joiner.toString(e.getValue()));
     }
   }
   return appendable;
 }