Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: sdk/lib/core/iterable.dart

Issue 13008021: Add optional writeAll separator argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/collection/collections.dart ('k') | sdk/lib/core/string_buffer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « sdk/lib/collection/collections.dart ('k') | sdk/lib/core/string_buffer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698