| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 * Changes the length of this list. | 147 * Changes the length of this list. |
| 148 * | 148 * |
| 149 * If [newLength] is greater than | 149 * If [newLength] is greater than |
| 150 * the current length, entries are initialized to [:null:]. | 150 * the current length, entries are initialized to [:null:]. |
| 151 * | 151 * |
| 152 * Throws an [UnsupportedError] if the list is fixed-length. | 152 * Throws an [UnsupportedError] if the list is fixed-length. |
| 153 */ | 153 */ |
| 154 void set length(int newLength); | 154 void set length(int newLength); |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * Replaces the last element of the list with [value]. | |
| 158 * | |
| 159 * Using `list.last = value` is equivalent to `list[list.length - 1] = value`, | |
| 160 * only shorter and more readable. | |
| 161 * | |
| 162 * The list must be modifiable and must have a length greater than zero. | |
| 163 */ | |
| 164 void set last(E value); | |
| 165 | |
| 166 /** | |
| 167 * Adds [value] to the end of this list, | 157 * Adds [value] to the end of this list, |
| 168 * extending the length by one. | 158 * extending the length by one. |
| 169 * | 159 * |
| 170 * Throws an [UnsupportedError] if the list is fixed-length. | 160 * Throws an [UnsupportedError] if the list is fixed-length. |
| 171 */ | 161 */ |
| 172 void add(E value); | 162 void add(E value); |
| 173 | 163 |
| 174 /** | 164 /** |
| 175 * Appends all objects of [iterable] to the end of this list. | 165 * Appends all objects of [iterable] to the end of this list. |
| 176 * | 166 * |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 * as values. The `Map.keys` [Iterable] iterates the indices of this list | 454 * as values. The `Map.keys` [Iterable] iterates the indices of this list |
| 465 * in numerical order. | 455 * in numerical order. |
| 466 * | 456 * |
| 467 * List<String> words = ['fee', 'fi', 'fo', 'fum']; | 457 * List<String> words = ['fee', 'fi', 'fo', 'fum']; |
| 468 * Map<int, String> map = words.asMap(); | 458 * Map<int, String> map = words.asMap(); |
| 469 * map[0] + map[1]; // 'feefi'; | 459 * map[0] + map[1]; // 'feefi'; |
| 470 * map.keys.toList(); // [0, 1, 2, 3] | 460 * map.keys.toList(); // [0, 1, 2, 3] |
| 471 */ | 461 */ |
| 472 Map<int, E> asMap(); | 462 Map<int, E> asMap(); |
| 473 } | 463 } |
| OLD | NEW |