code: private void append(StringBuffer result, CharacterIterator iterator) {
          if (iterator.first() != CharacterIterator.DONE) {
              char aChar;
  
              result.append(iterator.first());
              while ((aChar = iterator.next()) != CharacterIterator.DONE) {
                  result.append(aChar);
              }
          }
      }
docs: Convenience method to append all the characters in
  <code>iterator</code> to the StringBuffer <code>result</code>.