Index: sdk/lib/core/string_buffer.dart |
diff --git a/sdk/lib/core/string_buffer.dart b/sdk/lib/core/string_buffer.dart |
index 50bb51c4249c67031d4d2ce6bb674eac1a8d1c2c..6ecdc571d985d6a4bb5ff192213c99a96b0112f5 100644 |
--- a/sdk/lib/core/string_buffer.dart |
+++ b/sdk/lib/core/string_buffer.dart |
@@ -29,8 +29,20 @@ class StringBuffer implements StringSink { |
/// Adds the string representation of [charCode] to the buffer. |
external void writeCharCode(int charCode); |
- void writeAll(Iterable objects) { |
- for (Object obj in objects) write(obj); |
+ void writeAll(Iterable objects, [String separator = ""]) { |
+ Iterator iterator = objects.iterator; |
+ if (!iterator.moveNext()) return; |
+ if (separator == "") { |
+ do { |
+ write(iterator.current); |
+ } while (iterator.moveNext()); |
+ } else { |
+ write(iterator.current); |
+ while (iterator.moveNext()) { |
+ write(separator); |
+ write(iterator.current); |
+ } |
+ } |
} |
void writeln([Object obj = ""]) { |