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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 /** | 102 /** |
103 * Creates a list containing all [elements]. | 103 * Creates a list containing all [elements]. |
104 * | 104 * |
105 * The [Iterator] of [elements] provides the order of the elements. | 105 * The [Iterator] of [elements] provides the order of the elements. |
106 * | 106 * |
107 * This constructor returns a growable list when [growable] is true; | 107 * This constructor returns a growable list when [growable] is true; |
108 * otherwise, it returns a fixed-length list. | 108 * otherwise, it returns a fixed-length list. |
109 */ | 109 */ |
110 factory List.from(Iterable elements, { bool growable: true }) { | 110 factory List.from(Iterable elements, { bool growable: true }) { |
| 111 // TODO(jmesserly): fix this. This is just to unblock initial SDK check in. |
| 112 return null; |
| 113 /* |
111 List<E> list = new List<E>(); | 114 List<E> list = new List<E>(); |
112 for (E e in elements) { | 115 for (E e in elements) { |
113 list.add(e); | 116 list.add(e); |
114 } | 117 } |
115 if (growable) return list; | 118 if (growable) return list; |
116 return makeListFixedLength(list); | 119 return makeListFixedLength(list); |
| 120 */ |
117 } | 121 } |
118 | 122 |
119 /** | 123 /** |
120 * Generates a list of values. | 124 * Generates a list of values. |
121 * | 125 * |
122 * Creates a list with [length] positions and fills it with values created by | 126 * Creates a list with [length] positions and fills it with values created by |
123 * calling [generator] for each index in the range `0` .. `length - 1` | 127 * calling [generator] for each index in the range `0` .. `length - 1` |
124 * in increasing order. | 128 * in increasing order. |
125 * | 129 * |
126 * new List<int>.generate(3, (int index) => index * index); // [0, 1, 4] | 130 * new List<int>.generate(3, (int index) => index * index); // [0, 1, 4] |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 * as values. The `Map.keys` [Iterable] iterates the indices of this list | 475 * as values. The `Map.keys` [Iterable] iterates the indices of this list |
472 * in numerical order. | 476 * in numerical order. |
473 * | 477 * |
474 * List<String> words = ['fee', 'fi', 'fo', 'fum']; | 478 * List<String> words = ['fee', 'fi', 'fo', 'fum']; |
475 * Map<int, String> map = words.asMap(); | 479 * Map<int, String> map = words.asMap(); |
476 * map[0] + map[1]; // 'feefi'; | 480 * map[0] + map[1]; // 'feefi'; |
477 * map.keys.toList(); // [0, 1, 2, 3] | 481 * map.keys.toList(); // [0, 1, 2, 3] |
478 */ | 482 */ |
479 Map<int, E> asMap(); | 483 Map<int, E> asMap(); |
480 } | 484 } |
OLD | NEW |