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

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: Use insertBefore and add is-check. 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 /** 186 /**
187 * Removes all elements in the list. 187 * Removes all elements in the list.
188 * 188 *
189 * The length of the list becomes zero. 189 * The length of the list becomes zero.
190 * Throws an [UnsupportedError], and retains all elements, if the 190 * Throws an [UnsupportedError], and retains all elements, if the
191 * length of the list cannot be changed. 191 * length of the list cannot be changed.
192 */ 192 */
193 void clear(); 193 void clear();
194 194
195 /** 195 /**
196 * Removes the element at position[index] from the list. 196 * Inserts the element at position [index] in the list.
197 *
198 * This increases the length of the list by one and shifts all later elements
199 * towards the end of the list.
200 *
201 * It is an error if the [index] does not point inside the list or at the
202 * position after the last element.
203 */
204 void insert(int index, E element);
205
206 /**
207 * Removes the element at position [index] from the list.
197 * 208 *
198 * This reduces the length of the list by one and moves all later elements 209 * This reduces the length of the list by one and moves all later elements
199 * down by one position. 210 * down by one position.
200 * Returns the removed element. 211 * Returns the removed element.
201 * Throws an [ArgumentError] if [index] is not an [int]. 212 * Throws an [ArgumentError] if [index] is not an [int].
202 * Throws an [RangeError] if the [index] does not point inside 213 * Throws an [RangeError] if the [index] does not point inside
203 * the list. 214 * the list.
204 * Throws an [UnsupportedError], and doesn't remove the element, 215 * Throws an [UnsupportedError], and doesn't remove the element,
205 * if the length of the list cannot be changed. 216 * if the length of the list cannot be changed.
206 */ 217 */
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 void insertRange(int start, int length, [E fill]); 271 void insertRange(int start, int length, [E fill]);
261 272
262 /** 273 /**
263 * Returns an unmodifiable [Map] view of `this`. 274 * Returns an unmodifiable [Map] view of `this`.
264 * 275 *
265 * It has the indices of this list as keys, and the corresponding elements 276 * It has the indices of this list as keys, and the corresponding elements
266 * as values. 277 * as values.
267 */ 278 */
268 Map<int, E> asMap(); 279 Map<int, E> asMap();
269 } 280 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698