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

Side by Side Diff: sdk/lib/collection/list.dart

Issue 763443005: Fix implementation of the Iterable interface for typed data lists. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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
« runtime/lib/typed_data.dart ('K') | « runtime/vm/class_finalizer.cc ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.collection; 5 part of dart.collection;
6 6
7 /** 7 /**
8 * Abstract implementation of a list. 8 * Abstract implementation of a list.
9 * 9 *
10 * `ListBase` can be used as a base class for implementing the `List` interface. 10 * `ListBase` can be used as a base class for implementing the `List` interface.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 while (length > 1) { 315 while (length > 1) {
316 int pos = random.nextInt(length); 316 int pos = random.nextInt(length);
317 length -= 1; 317 length -= 1;
318 var tmp = this[length]; 318 var tmp = this[length];
319 this[length] = this[pos]; 319 this[length] = this[pos];
320 this[pos] = tmp; 320 this[pos] = tmp;
321 } 321 }
322 } 322 }
323 323
324 Map<int, E> asMap() { 324 Map<int, E> asMap() {
325 return new ListMapView(this); 325 return new ListMapView<E>(this);
326 } 326 }
327 327
328 List<E> sublist(int start, [int end]) { 328 List<E> sublist(int start, [int end]) {
329 int listLength = this.length; 329 int listLength = this.length;
330 if (end == null) end = listLength; 330 if (end == null) end = listLength;
331 RangeError.checkValidRange(start, end, listLength); 331 RangeError.checkValidRange(start, end, listLength);
332 int length = end - start; 332 int length = end - start;
333 List<E> result = new List<E>()..length = length; 333 List<E> result = new List<E>()..length = length;
334 for (int i = 0; i < length; i++) { 334 for (int i = 0; i < length; i++) {
335 result[i] = this[start + i]; 335 result[i] = this[start + i];
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 for (E element in iterable) { 495 for (E element in iterable) {
496 this[index++] = element; 496 this[index++] = element;
497 } 497 }
498 } 498 }
499 } 499 }
500 500
501 Iterable<E> get reversed => new ReversedListIterable<E>(this); 501 Iterable<E> get reversed => new ReversedListIterable<E>(this);
502 502
503 String toString() => IterableBase.iterableToFullString(this, '[', ']'); 503 String toString() => IterableBase.iterableToFullString(this, '[', ']');
504 } 504 }
OLDNEW
« runtime/lib/typed_data.dart ('K') | « runtime/vm/class_finalizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698