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

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

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
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. 8 * A [List] is an indexable collection with a length.
9 * 9 *
10 * A `List` implementation can be choose not to support all methods 10 * A `List` implementation can be choose not to support all methods
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 /** 182 /**
183 * Removes all elements in the list. 183 * Removes all elements in the list.
184 * 184 *
185 * The length of the list becomes zero. 185 * The length of the list becomes zero.
186 * Throws an [UnsupportedError], and retains all elements, if the 186 * Throws an [UnsupportedError], and retains all elements, if the
187 * length of the list cannot be changed. 187 * length of the list cannot be changed.
188 */ 188 */
189 void clear(); 189 void clear();
190 190
191 /** 191 /**
192 * Removes the element at position[index] from the list. 192 * Inserts the element at position [index] in the list.
193 *
194 * This increases the length of the list by one and moves all later elements
195 * up by one position.
196 *
197 * Throws an [ArgumentError] if [index] is not an [int].
srdjan 2013/03/04 00:53:47 That is not correct for checked mode.
Lasse Reichstein Nielsen 2013/03/04 09:06:02 I really prefer to just say "It's an error if ..."
floitsch 2013/03/05 17:51:58 The documentation had been copied from removeAt. d
198 * Throws an [RangeError] if the [index] does not point inside
srdjan 2013/03/04 00:53:47 s/an/a/
199 * the list, or at the position after the last element.
200 * Throws an [UnsupportedError], and doesn't remove the element,
Lasse Reichstein Nielsen 2013/03/04 09:06:02 No need to say that. That's what throwing an Unsup
201 * if the length of the list cannot be changed.
202 */
203 void insertAt(int index, E element);
204
205 /**
206 * Removes the element at position [index] from the list.
193 * 207 *
194 * This reduces the length of the list by one and moves all later elements 208 * This reduces the length of the list by one and moves all later elements
195 * down by one position. 209 * down by one position.
196 * Returns the removed element. 210 * Returns the removed element.
197 * Throws an [ArgumentError] if [index] is not an [int]. 211 * Throws an [ArgumentError] if [index] is not an [int].
198 * Throws an [RangeError] if the [index] does not point inside 212 * Throws an [RangeError] if the [index] does not point inside
199 * the list. 213 * the list.
200 * Throws an [UnsupportedError], and doesn't remove the element, 214 * Throws an [UnsupportedError], and doesn't remove the element,
201 * if the length of the list cannot be changed. 215 * if the length of the list cannot be changed.
202 */ 216 */
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 * not extendable. 262 * not extendable.
249 * If [length] is 0, this method does not do anything. 263 * If [length] is 0, this method does not do anything.
250 * If [start] is the length of the list, this method inserts the 264 * If [start] is the length of the list, this method inserts the
251 * range at the end of the list. 265 * range at the end of the list.
252 * Throws an [ArgumentError] if [length] is negative. 266 * Throws an [ArgumentError] if [length] is negative.
253 * Throws an [RangeError] if [start] is negative or if 267 * Throws an [RangeError] if [start] is negative or if
254 * [start] is greater than the length of the list. 268 * [start] is greater than the length of the list.
255 */ 269 */
256 void insertRange(int start, int length, [E fill]); 270 void insertRange(int start, int length, [E fill]);
257 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698