| OLD | NEW |
| 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 choose not to support all methods | 10 * A `List` implementation can choose not to support all methods |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 * var list = [1, 2, 3, 4, 5]; | 257 * var list = [1, 2, 3, 4, 5]; |
| 258 * var range = list.getRange(1, 4); | 258 * var range = list.getRange(1, 4); |
| 259 * print(range.join(', ')); // => 2, 3, 4 | 259 * print(range.join(', ')); // => 2, 3, 4 |
| 260 * list.length = 3; | 260 * list.length = 3; |
| 261 * print(range.join(', ')); // => 2, 3 | 261 * print(range.join(', ')); // => 2, 3 |
| 262 */ | 262 */ |
| 263 Iterable<E> getRange(int start, int end); | 263 Iterable<E> getRange(int start, int end); |
| 264 | 264 |
| 265 /** | 265 /** |
| 266 * Copies the elements of [iterable], skipping the [skipCount] first elements | 266 * Copies the elements of [iterable], skipping the [skipCount] first elements |
| 267 * into the range [start] - [end] of `this`. | 267 * into the range [start] - [end] (excluding) of `this`. |
| 268 * | 268 * |
| 269 * If [start] equals [end] and represent a legal range, this method has | 269 * If [start] equals [end] and represent a legal range, this method has |
| 270 * no effect. | 270 * no effect. |
| 271 * | 271 * |
| 272 * It is an error if [start]..[end] is not a valid range pointing into the | 272 * It is an error if [start]..[end] is not a valid range pointing into the |
| 273 * `this`. | 273 * `this`. |
| 274 * | 274 * |
| 275 * It is an error if the [iterable] does not have enough elements after | 275 * It is an error if the [iterable] does not have enough elements after |
| 276 * skipping [skipCount] elements. | 276 * skipping [skipCount] elements. |
| 277 */ | 277 */ |
| 278 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]); | 278 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]); |
| 279 | 279 |
| 280 /** | 280 /** |
| 281 * Removes [length] elements from the list, beginning at [start]. | 281 * Removes the elements in the range [start]..[end] (excluding). |
| 282 * Throws an [UnsupportedError] if the list is | 282 * |
| 283 * not extendable. | 283 * It is an error if [start]..[end] is not a valid range pointing into the |
| 284 * If [length] is 0, this method does not do anything. | 284 * `this`. |
| 285 * Throws an [ArgumentError] if [length] is negative. | |
| 286 * Throws an [RangeError] if [start] or | |
| 287 * [:start + length: - 1] are out of range. | |
| 288 */ | 285 */ |
| 289 void removeRange(int start, int length); | 286 void removeRange(int start, int end); |
| 290 | |
| 291 /** | |
| 292 * Inserts a new range into the list, starting from [start] to | |
| 293 * [:start + length - 1:]. The entries are filled with [fill]. | |
| 294 * Throws an [UnsupportedError] if the list is | |
| 295 * not extendable. | |
| 296 * If [length] is 0, this method does not do anything. | |
| 297 * If [start] is the length of the list, this method inserts the | |
| 298 * range at the end of the list. | |
| 299 * Throws an [ArgumentError] if [length] is negative. | |
| 300 * Throws an [RangeError] if [start] is negative or if | |
| 301 * [start] is greater than the length of the list. | |
| 302 */ | |
| 303 void insertRange(int start, int length, [E fill]); | |
| 304 | 287 |
| 305 /** | 288 /** |
| 306 * Returns an unmodifiable [Map] view of `this`. | 289 * Returns an unmodifiable [Map] view of `this`. |
| 307 * | 290 * |
| 308 * It has the indices of this list as keys, and the corresponding elements | 291 * It has the indices of this list as keys, and the corresponding elements |
| 309 * as values. | 292 * as values. |
| 310 */ | 293 */ |
| 311 Map<int, E> asMap(); | 294 Map<int, E> asMap(); |
| 312 } | 295 } |
| OLD | NEW |