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

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: Rename insertAt to insert.~ 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 /** 185 /**
186 * Removes all elements in the list. 186 * Removes all elements in the list.
187 * 187 *
188 * The length of the list becomes zero. 188 * The length of the list becomes zero.
189 * Throws an [UnsupportedError], and retains all elements, if the 189 * Throws an [UnsupportedError], and retains all elements, if the
190 * length of the list cannot be changed. 190 * length of the list cannot be changed.
191 */ 191 */
192 void clear(); 192 void clear();
193 193
194 /** 194 /**
195 * Removes the element at position[index] from the list. 195 * Inserts the element at position [index] in the list.
196 *
197 * This increases the length of the list by one and moves all later elements
198 * up by one position.
srdjan 2013/03/06 17:08:37 'up' is an interesting direction. I always though
Lasse Reichstein Nielsen 2013/03/07 09:57:53 I'd expect "moving up" to move towards the start.
floitsch 2013/03/07 12:53:53 Changed to "shifts all later elements towards the
199 *
200 * It is an error if the [index] is `null`, or if the [index] does not point
Lasse Reichstein Nielsen 2013/03/07 09:57:53 Skip the null part. That's included in "not pointi
floitsch 2013/03/07 12:53:53 Done.
201 * inside the list or at the position after the last element.
202 */
203 void insert(int index, E element);
204
205 /**
206 * Removes the element at position [index] from the list.
196 * 207 *
197 * 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
198 * down by one position. 209 * down by one position.
199 * Returns the removed element. 210 * Returns the removed element.
200 * Throws an [ArgumentError] if [index] is not an [int]. 211 * Throws an [ArgumentError] if [index] is not an [int].
201 * Throws an [RangeError] if the [index] does not point inside 212 * Throws an [RangeError] if the [index] does not point inside
202 * the list. 213 * the list.
203 * Throws an [UnsupportedError], and doesn't remove the element, 214 * Throws an [UnsupportedError], and doesn't remove the element,
204 * if the length of the list cannot be changed. 215 * if the length of the list cannot be changed.
205 */ 216 */
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void insertRange(int start, int length, [E fill]); 270 void insertRange(int start, int length, [E fill]);
260 271
261 /** 272 /**
262 * Returns an unmodifiable [Map] view of `this`. 273 * Returns an unmodifiable [Map] view of `this`.
263 * 274 *
264 * It has the indices of this list as keys, and the corresponding elements 275 * It has the indices of this list as keys, and the corresponding elements
265 * as values. 276 * as values.
266 */ 277 */
267 Map<int, E> asMap(); 278 Map<int, E> asMap();
268 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698