Chromium Code Reviews| 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 * An indexable collection of objects with a length. | 8 * An indexable collection of objects with a length. |
| 9 * | 9 * |
| 10 * Subclasses of this class implement different kinds of lists. | 10 * Subclasses of this class implement different kinds of lists. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 * fixedLengthList.length; // 3 | 53 * fixedLengthList.length; // 3 |
| 54 * fixedLengthList.length = 1; // Error | 54 * fixedLengthList.length = 1; // Error |
| 55 * | 55 * |
| 56 * | 56 * |
| 57 * The list has length 0 and is growable if [length] is omitted. | 57 * The list has length 0 and is growable if [length] is omitted. |
| 58 * | 58 * |
| 59 * List growableList = new List(); | 59 * List growableList = new List(); |
| 60 * growableList.length; // 0; | 60 * growableList.length; // 0; |
| 61 * growableList.length = 3; | 61 * growableList.length = 3; |
| 62 * | 62 * |
| 63 * An error occurs if [length] is negative. | 63 * The [length] must not be negative or null, if it is provided. |
| 64 */ | 64 */ |
| 65 external factory List([int length]); | 65 external factory List([int length]); |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Creates a fixed-length list of the given length, and initializes the | 68 * Creates a fixed-length list of the given length, and initializes the |
| 69 * value at each position with [fill]: | 69 * value at each position with [fill]: |
| 70 * | 70 * |
| 71 * new List<int>.filled(3, 0); // [0, 0, 0] | 71 * new List<int>.filled(3, 0); // [0, 0, 0] |
| 72 * | |
| 73 * The [length] must not be negative or null. | |
|
Anders Johnsen
2013/10/30 10:31:27
"The [length] must be a positive integer." ?
and
| |
| 72 */ | 74 */ |
| 73 external factory List.filled(int length, E fill); | 75 external factory List.filled(int length, E fill); |
| 74 | 76 |
| 75 /** | 77 /** |
| 76 * Creates a list and initializes it using the contents of [other]. | 78 * Creates a list and initializes it using the contents of [other]. |
| 77 * | 79 * |
| 78 * The [Iterator] of [other] provides the order of the objects. | 80 * The [Iterator] of [other] provides the order of the objects. |
| 79 * | 81 * |
| 80 * This constructor returns a growable list if [growable] is true; | 82 * This constructor returns a growable list if [growable] is true; |
| 81 * otherwise, it returns a fixed-length list. | 83 * otherwise, it returns a fixed-length list. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 * as values. The `Map.keys` [Iterable] iterates the indices of this list | 438 * as values. The `Map.keys` [Iterable] iterates the indices of this list |
| 437 * in numerical order. | 439 * in numerical order. |
| 438 * | 440 * |
| 439 * List<String> words = ['fee', 'fi', 'fo', 'fum']; | 441 * List<String> words = ['fee', 'fi', 'fo', 'fum']; |
| 440 * Map<int, String> map = words.asMap(); | 442 * Map<int, String> map = words.asMap(); |
| 441 * map[0] + map[1]; // 'feefi'; | 443 * map[0] + map[1]; // 'feefi'; |
| 442 * map.keys.toList(); // [0, 1, 2, 3] | 444 * map.keys.toList(); // [0, 1, 2, 3] |
| 443 */ | 445 */ |
| 444 Map<int, E> asMap(); | 446 Map<int, E> asMap(); |
| 445 } | 447 } |
| OLD | NEW |