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

Side by Side Diff: runtime/lib/growable_array.dart

Issue 13945009: Make default argument to Iterable.join be "". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/typeddata.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class _GrowableObjectArray<T> implements List<T> { 5 class _GrowableObjectArray<T> implements List<T> {
6 factory _GrowableObjectArray._uninstantiable() { 6 factory _GrowableObjectArray._uninstantiable() {
7 throw new UnsupportedError( 7 throw new UnsupportedError(
8 "GrowableObjectArray can only be allocated by the VM"); 8 "GrowableObjectArray can only be allocated by the VM");
9 } 9 }
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 void forEach(f(T element)) { 237 void forEach(f(T element)) {
238 // TODO(srdjan): Use IterableMixinWorkaround.forEach(this, f); 238 // TODO(srdjan): Use IterableMixinWorkaround.forEach(this, f);
239 // Accessing the list directly improves DeltaBlue performance by 25%. 239 // Accessing the list directly improves DeltaBlue performance by 25%.
240 for (int i = 0; i < length; i++) { 240 for (int i = 0; i < length; i++) {
241 f(this[i]); 241 f(this[i]);
242 } 242 }
243 } 243 }
244 244
245 String join([String separator]) { 245 String join([String separator = ""]) {
246 if (isEmpty) return ""; 246 if (isEmpty) return "";
247 if (this.length == 1) return "${this[0]}"; 247 if (this.length == 1) return "${this[0]}";
248 StringBuffer buffer = new StringBuffer(); 248 StringBuffer buffer = new StringBuffer();
249 if (separator == null || separator == "") { 249 if (separator.isEmpty) {
250 for (int i = 0; i < this.length; i++) { 250 for (int i = 0; i < this.length; i++) {
251 buffer.write("${this[i]}"); 251 buffer.write("${this[i]}");
252 } 252 }
253 } else { 253 } else {
254 buffer.write("${this[0]}"); 254 buffer.write("${this[0]}");
255 for (int i = 1; i < this.length; i++) { 255 for (int i = 1; i < this.length; i++) {
256 buffer.write(separator); 256 buffer.write(separator);
257 buffer.write("${this[i]}"); 257 buffer.write("${this[i]}");
258 } 258 }
259 } 259 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 Set<T> toSet() { 349 Set<T> toSet() {
350 return new Set<T>.from(this); 350 return new Set<T>.from(this);
351 } 351 }
352 352
353 Map<int, T> asMap() { 353 Map<int, T> asMap() {
354 return IterableMixinWorkaround.asMapList(this); 354 return IterableMixinWorkaround.asMapList(this);
355 } 355 }
356 } 356 }
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/typeddata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698