| 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. It can be of | 8 * A [List] is an indexable collection with a length. It can be of |
| 9 * fixed size or extendable. | 9 * fixed size or extendable. |
| 10 */ | 10 */ |
| 11 abstract class List<E> implements Collection<E> { | 11 abstract class List<E> implements Collection<E> { |
| 12 /** | 12 /** |
| 13 * Creates a list of the given [length]. | 13 * Creates a list of the given [length]. |
| 14 * | 14 * |
| 15 * The length of the returned list is not fixed. | 15 * The length of the returned list is not fixed. |
| 16 */ | 16 */ |
| 17 external factory List([int length = 0]); | 17 external factory List([int length = 0]); |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Creates a fixed-sized list of the given [length] where each entry is | 20 * Creates a fixed-sized list of the given [length] where each entry is |
| 21 * filled with [fill]. | 21 * filled with [fill]. |
| 22 */ | 22 */ |
| 23 external factory List.fixedLength(int length, {E fill: null}); | 23 external factory List.fixedLength(int length, {E fill: null}); |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Creates an list of the given [length] where each entry is | |
| 27 * filled with [fill]. | |
| 28 * | |
| 29 * The length of the returned list is not fixed. | |
| 30 */ | |
| 31 external factory List.filled(int length, E fill); | |
| 32 | |
| 33 /** | |
| 34 * Creates an list with the elements of [other]. The order in | 26 * Creates an list with the elements of [other]. The order in |
| 35 * the list will be the order provided by the iterator of [other]. | 27 * the list will be the order provided by the iterator of [other]. |
| 36 * | 28 * |
| 37 * The length of the returned list is not fixed. | 29 * The length of the returned list is not fixed. |
| 38 */ | 30 */ |
| 39 factory List.from(Iterable other) { | 31 factory List.from(Iterable other) { |
| 40 var list = new List<E>(); | 32 var list = new List<E>(); |
| 41 for (E e in other) { | 33 for (E e in other) { |
| 42 list.add(e); | 34 list.add(e); |
| 43 } | 35 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 /** | 216 /** |
| 225 * Returns an unmodifiable [List] with at most [n] elements. | 217 * Returns an unmodifiable [List] with at most [n] elements. |
| 226 * | 218 * |
| 227 * The returned list is a view backed by this. | 219 * The returned list is a view backed by this. |
| 228 * | 220 * |
| 229 * The returned [List] may contain fewer than [n] elements, while [:this:] | 221 * The returned [List] may contain fewer than [n] elements, while [:this:] |
| 230 * contains fewer than [n] elements. | 222 * contains fewer than [n] elements. |
| 231 */ | 223 */ |
| 232 List<E> take(int n); | 224 List<E> take(int n); |
| 233 } | 225 } |
| OLD | NEW |