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