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

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

Issue 11366111: Make Iterable more powerful (and lazy). (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Undo unintended change. Created 8 years, 1 month 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
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 /** 5 /**
6 * A [List] is an indexable collection with a length. It can be of 6 * A [List] is an indexable collection with a length. It can be of
7 * fixed size or extendable. 7 * fixed size or extendable.
8 */ 8 */
9 interface List<E> extends Collection<E>, Sequence<E> 9 interface List<E> extends Collection<E>, Sequence<E>
10 default _ListImpl<E> { 10 default _ListImpl<E> {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void set length(int newLength); 45 void set length(int newLength);
46 46
47 /** 47 /**
48 * Adds [value] at the end of the list, extending the length by 48 * Adds [value] at the end of the list, extending the length by
49 * one. Throws an [UnsupportedError] if the list is not 49 * one. Throws an [UnsupportedError] if the list is not
50 * extendable. 50 * extendable.
51 */ 51 */
52 void add(E value); 52 void add(E value);
53 53
54 /** 54 /**
55 * Adds [value] at the end of the list, extending the length by 55 * Alias for [add].
Lasse Reichstein Nielsen 2012/11/12 09:38:03 Remove it. It's slightly misnamed (other operation
56 * one. Throws an [UnsupportedError] if the list is not
57 * extendable.
58 */ 56 */
59 void addLast(E value); 57 void addLast(E value);
60 58
61 /** 59 /**
62 * Appends all elements of the [collection] to the end of this list. 60 * Appends all elements of the [collection] to the end of this list.
63 * Extends the length of the list by the number of elements in [collection]. 61 * Extends the length of the list by the number of elements in [collection].
64 * Throws an [UnsupportedError] if this list is not 62 * Throws an [UnsupportedError] if this list is not
65 * extendable. 63 * extendable.
66 */ 64 */
67 void addAll(Collection<E> collection); 65 void addAll(Collection<E> collection);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 */ 120 */
123 E removeLast(); 121 E removeLast();
124 122
125 /** 123 /**
126 * Returns the last element of the list, or throws an out of bounds 124 * Returns the last element of the list, or throws an out of bounds
127 * exception if the list is empty. 125 * exception if the list is empty.
128 */ 126 */
129 E get last; 127 E get last;
130 128
131 /** 129 /**
130 * Returns a read-only view of [this].
131 *
132 * The returned [List] will be backed by [this], but cannot change [this].
133 */
134 List<E> get view;
Lasse Reichstein Nielsen 2012/11/12 09:38:03 I still don't think 'view' signifies something inh
135
136 /**
132 * Returns a new list containing [length] elements from the list, 137 * Returns a new list containing [length] elements from the list,
133 * starting at [start]. 138 * starting at [start].
134 * Returns an empty list if [length] is 0. 139 * Returns an empty list if [length] is 0.
135 * Throws an [ArgumentError] if [length] is negative. 140 * Throws an [ArgumentError] if [length] is negative.
136 * Throws an [RangeError] if [start] or 141 * Throws an [RangeError] if [start] or
137 * [:start + length - 1:] are out of range. 142 * [:start + length - 1:] are out of range.
138 */ 143 */
139 List<E> getRange(int start, int length); 144 List<E> getRange(int start, int length);
140 145
141 /** 146 /**
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 external factory List([int length]); 189 external factory List([int length]);
185 190
186 /** 191 /**
187 * Factory implementation of List.from(). 192 * Factory implementation of List.from().
188 * 193 *
189 * Creates a list with the elements of [other]. The order in 194 * Creates a list with the elements of [other]. The order in
190 * the list will be the order provided by the iterator of [other]. 195 * the list will be the order provided by the iterator of [other].
191 */ 196 */
192 external factory List.from(Iterable<E> other); 197 external factory List.from(Iterable<E> other);
193 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698