Index: sdk/lib/core/iterable.dart |
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart |
index 604c4a88940ff9bbe8cf1dc08cd88ded2e160531..83618ce3c2f3936a9c59450dad520476f0829182 100644 |
--- a/sdk/lib/core/iterable.dart |
+++ b/sdk/lib/core/iterable.dart |
@@ -128,20 +128,8 @@ abstract class Iterable<E> { |
* string. |
*/ |
String join([String separator]) { |
- Iterator<E> iterator = this.iterator; |
- if (!iterator.moveNext()) return ""; |
StringBuffer buffer = new StringBuffer(); |
- if (separator == null || separator == "") { |
- do { |
- buffer.write("${iterator.current}"); |
- } while (iterator.moveNext()); |
- } else { |
- buffer.write("${iterator.current}"); |
- while (iterator.moveNext()) { |
- buffer.write(separator); |
- buffer.write("${iterator.current}"); |
- } |
- } |
+ buffer.writeAll(this, separator == null ? "" : separator); |
return buffer.toString(); |
} |