| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 E removeAt(int index); | 215 E removeAt(int index); |
| 216 | 216 |
| 217 /** | 217 /** |
| 218 * Pops and returns the last element of the list. | 218 * Pops and returns the last element of the list. |
| 219 * Throws a [UnsupportedError] if the length of the | 219 * Throws a [UnsupportedError] if the length of the |
| 220 * list cannot be changed. | 220 * list cannot be changed. |
| 221 */ | 221 */ |
| 222 E removeLast(); | 222 E removeLast(); |
| 223 | 223 |
| 224 /** | 224 /** |
| 225 * Returns a new list containing the elemenst from [start] to [end]. | 225 * Returns a new list containing the elements from [start] to [end]. |
| 226 * | 226 * |
| 227 * If [end] is omitted, the [length] of the list is used. | 227 * If [end] is omitted, the [length] of the list is used. |
| 228 * | 228 * |
| 229 * It is an error if [start] or [end] are not list indices for this list, | 229 * It is an error if [start] or [end] are not list indices for this list, |
| 230 * or if [end] is before [start]. | 230 * or if [end] is before [start]. |
| 231 */ | 231 */ |
| 232 List<E> sublist(int start, [int end]); | 232 List<E> sublist(int start, [int end]); |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * *Deprecated*. Use [sublist] instead. | 235 * Returns an [Iterable] that iterators over the elements in the range |
| 236 * [start] to [end] (exclusive). The result of this function is backed by |
| 237 * `this`. |
| 238 * |
| 239 * It is an error if [end] is before [start]. |
| 240 * |
| 241 * It is an error if the [start] and [end] are not valid ranges at the time |
| 242 * of the call to this method. The returned [Iterable] behaves similar to |
| 243 * `skip(start).take(end - start)`. That is, it will not throw exceptions |
| 244 * if `this` changes size. |
| 245 * |
| 246 * Example: |
| 247 * |
| 248 * var list = [1, 2, 3, 4, 5]; |
| 249 * var range = list.getRange(1, 4); |
| 250 * print(range.join(', ')); // => 2, 3, 4 |
| 251 * list.length = 3; |
| 252 * print(range.join(', ')); // => 2, 3 |
| 236 */ | 253 */ |
| 237 @deprecated | 254 Iterable<E> getRange(int start, int end); |
| 238 List<E> getRange(int start, int length); | |
| 239 | 255 |
| 240 /** | 256 /** |
| 241 * Copies [length] elements of [from], starting | 257 * Copies [length] elements of [from], starting |
| 242 * at [startFrom], into the list, starting at [start]. | 258 * at [startFrom], into the list, starting at [start]. |
| 243 * If [length] is 0, this method does not do anything. | 259 * If [length] is 0, this method does not do anything. |
| 244 * Throws an [ArgumentError] if [length] is negative. | 260 * Throws an [ArgumentError] if [length] is negative. |
| 245 * Throws an [RangeError] if [start] or | 261 * Throws an [RangeError] if [start] or |
| 246 * [:start + length - 1:] are out of range for [:this:], or if | 262 * [:start + length - 1:] are out of range for [:this:], or if |
| 247 * [startFrom] or [:startFrom + length - 1:] are out of range for [from]. | 263 * [startFrom] or [:startFrom + length - 1:] are out of range for [from]. |
| 248 */ | 264 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 274 void insertRange(int start, int length, [E fill]); | 290 void insertRange(int start, int length, [E fill]); |
| 275 | 291 |
| 276 /** | 292 /** |
| 277 * Returns an unmodifiable [Map] view of `this`. | 293 * Returns an unmodifiable [Map] view of `this`. |
| 278 * | 294 * |
| 279 * It has the indices of this list as keys, and the corresponding elements | 295 * It has the indices of this list as keys, and the corresponding elements |
| 280 * as values. | 296 * as values. |
| 281 */ | 297 */ |
| 282 Map<int, E> asMap(); | 298 Map<int, E> asMap(); |
| 283 } | 299 } |
| OLD | NEW |