| 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 18 matching lines...) Expand all Loading... |
| 29 * growableList[0] = 87; | 29 * growableList[0] = 87; |
| 30 * | 30 * |
| 31 * Lists are [Iterable]. Iteration occurs over values in index order. Changing | 31 * Lists are [Iterable]. Iteration occurs over values in index order. Changing |
| 32 * the values does not affect iteration, but changing the valid | 32 * the values does not affect iteration, but changing the valid |
| 33 * indices—that is, changing the list's length—between iteration | 33 * indices—that is, changing the list's length—between iteration |
| 34 * steps causes a [ConcurrentModificationError]. This means that only growable | 34 * steps causes a [ConcurrentModificationError]. This means that only growable |
| 35 * lists can throw ConcurrentModificationError. If the length changes | 35 * lists can throw ConcurrentModificationError. If the length changes |
| 36 * temporarily and is restored before continuing the iteration, the iterator | 36 * temporarily and is restored before continuing the iteration, the iterator |
| 37 * does not detect it. | 37 * does not detect it. |
| 38 */ | 38 */ |
| 39 abstract class List<E> implements Iterable<E> { | 39 abstract class List<E> implements Iterable<E>, EfficientLength { |
| 40 /** | 40 /** |
| 41 * Creates a list of the given length. | 41 * Creates a list of the given length. |
| 42 * | 42 * |
| 43 * The created list is fixed-length if [length] is provided. | 43 * The created list is fixed-length if [length] is provided. |
| 44 * | 44 * |
| 45 * List fixedLengthList = new List(3); | 45 * List fixedLengthList = new List(3); |
| 46 * fixedLengthList.length; // 3 | 46 * fixedLengthList.length; // 3 |
| 47 fixedLengthList.length = 1; // Error | 47 fixedLengthList.length = 1; // Error |
| 48 * | 48 * |
| 49 * | 49 * |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 * as values. The `Map.keys` [Iterable] iterates the indices of this list | 429 * as values. The `Map.keys` [Iterable] iterates the indices of this list |
| 430 * in numerical order. | 430 * in numerical order. |
| 431 * | 431 * |
| 432 * List<String> words = ['fee', 'fi', 'fo', 'fum']; | 432 * List<String> words = ['fee', 'fi', 'fo', 'fum']; |
| 433 * Map<int, String> map = words.asMap(); | 433 * Map<int, String> map = words.asMap(); |
| 434 * map[0] + map[1]; // 'feefi'; | 434 * map[0] + map[1]; // 'feefi'; |
| 435 * map.keys.toList(); // [0, 1, 2, 3] | 435 * map.keys.toList(); // [0, 1, 2, 3] |
| 436 */ | 436 */ |
| 437 Map<int, E> asMap(); | 437 Map<int, E> asMap(); |
| 438 } | 438 } |
| OLD | NEW |