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

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

Issue 11896013: Add List.reversed to give a reverse fixed-length view of a list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved some functionality to separate CL. Created 7 years, 11 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') | samples/swarm/swarm_ui_lib/observable/observable.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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 284 }
285 285
286 bool get isEmpty { 286 bool get isEmpty {
287 return this.length == 0; 287 return this.length == 0;
288 } 288 }
289 289
290 void clear() { 290 void clear() {
291 this.length = 0; 291 this.length = 0;
292 } 292 }
293 293
294 List<T> get reversed => new ReversedListView<T>(this, 0, null);
295
294 void sort([int compare(T a, T b)]) { 296 void sort([int compare(T a, T b)]) {
295 IterableMixinWorkaround.sortList(this, compare); 297 IterableMixinWorkaround.sortList(this, compare);
296 } 298 }
297 299
298 String toString() { 300 String toString() {
299 return Collections.collectionToString(this); 301 return Collections.collectionToString(this);
300 } 302 }
301 303
302 Iterator<T> get iterator { 304 Iterator<T> get iterator {
303 return new ListIterator<T>(this); 305 return new ListIterator<T>(this);
304 } 306 }
305 307
306 List<T> toList() { 308 List<T> toList() {
307 return new List<T>.from(this); 309 return new List<T>.from(this);
308 } 310 }
309 311
310 Set<T> toSet() { 312 Set<T> toSet() {
311 return new Set<T>.from(this); 313 return new Set<T>.from(this);
312 } 314 }
313 } 315 }
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | samples/swarm/swarm_ui_lib/observable/observable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698