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 /** | 5 /** |
6 * A [List] is an indexable collection with a length. It can be of | 6 * A [List] is an indexable collection with a length. It can be of |
7 * fixed size or extendable. | 7 * fixed size or extendable. |
8 */ | 8 */ |
9 interface List<E> extends Collection<E>, Sequence<E> | 9 interface List<E> extends Collection<E>, Sequence<E> |
10 default ListImplementation<E> { | 10 default ListImplementation<E> { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * Pops and returns the last element of the list. | 119 * Pops and returns the last element of the list. |
120 * Throws a [UnsupportedError] if the length of the | 120 * Throws a [UnsupportedError] if the length of the |
121 * list cannot be changed. | 121 * list cannot be changed. |
122 */ | 122 */ |
123 E removeLast(); | 123 E removeLast(); |
124 | 124 |
125 /** | 125 /** |
126 * Returns the last element of the list, or throws an out of bounds | 126 * Returns the last element of the list, or throws an out of bounds |
127 * exception if the list is empty. | 127 * exception if the list is empty. |
128 */ | 128 */ |
129 E last(); | 129 E get last; |
130 | 130 |
131 /** | 131 /** |
132 * Returns a new list containing [length] elements from the list, | 132 * Returns a new list containing [length] elements from the list, |
133 * starting at [start]. | 133 * starting at [start]. |
134 * Returns an empty list if [length] is 0. | 134 * Returns an empty list if [length] is 0. |
135 * Throws an [ArgumentError] if [length] is negative. | 135 * Throws an [ArgumentError] if [length] is negative. |
136 * Throws an [IndexOutOfRangeException] if [start] or | 136 * Throws an [IndexOutOfRangeException] if [start] or |
137 * [:start + length - 1:] are out of range. | 137 * [:start + length - 1:] are out of range. |
138 */ | 138 */ |
139 List<E> getRange(int start, int length); | 139 List<E> getRange(int start, int length); |
(...skipping 27 matching lines...) Expand all Loading... |
167 * not extendable. | 167 * not extendable. |
168 * If [length] is 0, this method does not do anything. | 168 * If [length] is 0, this method does not do anything. |
169 * If [start] is the length of the list, this method inserts the | 169 * If [start] is the length of the list, this method inserts the |
170 * range at the end of the list. | 170 * range at the end of the list. |
171 * Throws an [ArgumentError] if [length] is negative. | 171 * Throws an [ArgumentError] if [length] is negative. |
172 * Throws an [IndexOutOfRangeException] if [start] is negative or if | 172 * Throws an [IndexOutOfRangeException] if [start] is negative or if |
173 * [start] is greater than the length of the list. | 173 * [start] is greater than the length of the list. |
174 */ | 174 */ |
175 void insertRange(int start, int length, [E initialValue]); | 175 void insertRange(int start, int length, [E initialValue]); |
176 } | 176 } |
OLD | NEW |