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

Side by Side Diff: sdk/lib/core/list.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 | « sdk/lib/core/errors.dart ('k') | sdk/lib/html/html_common/filtered_element_list.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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A [List] is an indexable collection with a length. It can be of 8 * A [List] is an indexable collection with a length. It can be of
9 * fixed size or extendable. 9 * fixed size or extendable.
10 */ 10 */
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void addLast(E value); 78 void addLast(E value);
79 79
80 /** 80 /**
81 * Appends all elements of the [iterable] to the end of this list. 81 * Appends all elements of the [iterable] to the end of this list.
82 * Extends the length of the list by the number of elements in [iterable]. 82 * Extends the length of the list by the number of elements in [iterable].
83 * Throws an [UnsupportedError] if this list is not extensible. 83 * Throws an [UnsupportedError] if this list is not extensible.
84 */ 84 */
85 void addAll(Iterable<E> iterable); 85 void addAll(Iterable<E> iterable);
86 86
87 /** 87 /**
88 * Returns a reversed fixed-length view of this [List].
89 *
90 * The reversed list has elements in the opposite order of this list.
91 * It is backed by this list, but will stop working if this list
92 * becomes shorter than its current length.
93 */
94 List<T> get reversed => new ReversedList(this, 0, length);
95
96 /**
88 * Sorts the list according to the order specified by the [compare] function. 97 * Sorts the list according to the order specified by the [compare] function.
89 * 98 *
90 * The [compare] function must act as a [Comparator]. 99 * The [compare] function must act as a [Comparator].
91 * The default [List] implementations use [Comparable.compare] if 100 * The default [List] implementations use [Comparable.compare] if
92 * [compare] is omitted. 101 * [compare] is omitted.
93 */ 102 */
94 void sort([int compare(E a, E b)]); 103 void sort([int compare(E a, E b)]);
95 104
96 /** 105 /**
97 * Returns the first index of [element] in the list. 106 * Returns the first index of [element] in the list.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 * not extendable. 192 * not extendable.
184 * If [length] is 0, this method does not do anything. 193 * If [length] is 0, this method does not do anything.
185 * If [start] is the length of the list, this method inserts the 194 * If [start] is the length of the list, this method inserts the
186 * range at the end of the list. 195 * range at the end of the list.
187 * Throws an [ArgumentError] if [length] is negative. 196 * Throws an [ArgumentError] if [length] is negative.
188 * Throws an [RangeError] if [start] is negative or if 197 * Throws an [RangeError] if [start] is negative or if
189 * [start] is greater than the length of the list. 198 * [start] is greater than the length of the list.
190 */ 199 */
191 void insertRange(int start, int length, [E fill]); 200 void insertRange(int start, int length, [E fill]);
192 } 201 }
OLDNEW
« no previous file with comments | « sdk/lib/core/errors.dart ('k') | sdk/lib/html/html_common/filtered_element_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698