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

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

Issue 11316059: Add List.first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js interceptor and add test. 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 E removeAt(int index); 116 E removeAt(int index);
117 117
118 /** 118 /**
119 * Pops and returns the last element of the list. 119 * Pops and returns the last element of the list.
120 * Throws a [UnsupportedError] if the length of the 120 * Throws a [UnsupportedError] if the length of the
121 * list cannot be changed. 121 * list cannot be changed.
122 */ 122 */
123 E removeLast(); 123 E removeLast();
124 124
125 /** 125 /**
126 * Returns the first element of the list, or throws an out of bounds
127 * exception if the list is empty.
128 */
129 E get first;
130
131 /**
126 * Returns the last element of the list, or throws an out of bounds 132 * Returns the last element of the list, or throws an out of bounds
127 * exception if the list is empty. 133 * exception if the list is empty.
128 */ 134 */
129 E get last; 135 E get last;
130 136
131 /** 137 /**
132 * Returns a new list containing [length] elements from the list, 138 * Returns a new list containing [length] elements from the list,
133 * starting at [start]. 139 * starting at [start].
134 * Returns an empty list if [length] is 0. 140 * Returns an empty list if [length] is 0.
135 * Throws an [ArgumentError] if [length] is negative. 141 * Throws an [ArgumentError] if [length] is negative.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 external factory List([int length]); 190 external factory List([int length]);
185 191
186 /** 192 /**
187 * Factory implementation of List.from(). 193 * Factory implementation of List.from().
188 * 194 *
189 * Creates a list with the elements of [other]. The order in 195 * Creates a list with the elements of [other]. The order in
190 * the list will be the order provided by the iterator of [other]. 196 * the list will be the order provided by the iterator of [other].
191 */ 197 */
192 external factory List.from(Iterable<E> other); 198 external factory List.from(Iterable<E> other);
193 } 199 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/interceptors.dart ('k') | sdk/lib/core/sequences.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698