OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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> factory ListFactory { | 9 interface List<E> extends Collection<E> factory ListFactory { |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 last(); |
130 | 130 |
131 /** | 131 /** |
132 * Returns a sub list copy of this list, from [start] to | 132 * Returns a sub list copy of this list, from [start] to |
133 * [:start + length:]. | 133 * [:start + length:]. |
134 * Returns an empty list if [length] is 0. | 134 * Returns an empty list if [length] is 0. |
| 135 * Throws an [IllegalArgumentException] if [length] is negative. |
135 * Throws an [IndexOutOfRangeException] if [start] or | 136 * Throws an [IndexOutOfRangeException] if [start] or |
136 * [:start + length:] are out of range. | 137 * [:start + length:] are out of range. |
137 */ | 138 */ |
138 List<E> getRange(int start, int length); | 139 List<E> getRange(int start, int length); |
139 | 140 |
140 /** | 141 /** |
141 * Copies [length] elements of the [from] array, starting | 142 * Copies [length] elements of the [from] array, starting |
142 * from [startFrom], into [:this:], starting at [start]. | 143 * from [startFrom], into [:this:], starting at [start]. |
143 * Throws an [UnsupportedOperationException] if the list is | 144 * Throws an [UnsupportedOperationException] if the list is |
144 * not extendable. | 145 * not extendable. |
145 * If [length] is 0, this method does not do anything. | 146 * If [length] is 0, this method does not do anything. |
| 147 * Throws an [IllegalArgumentException] if [length] is negative. |
146 * Throws an [IndexOutOfRangeException] if [start] or | 148 * Throws an [IndexOutOfRangeException] if [start] or |
147 * [:start + length:] are out of range for [:this:], or if | 149 * [:start + length:] are out of range for [:this:], or if |
148 * [startFrom] is out of range for [from]. | 150 * [startFrom] is out of range for [from]. |
149 */ | 151 */ |
150 void setRange(int start, int length, List<E> from, [int startFrom]); | 152 void setRange(int start, int length, List<E> from, [int startFrom]); |
151 | 153 |
152 /** | 154 /** |
153 * Removes the range in the list starting from [start] to | 155 * Removes the range in the list starting from [start] to |
154 * [:start + length:]. | 156 * [:start + length:]. |
155 * Throws an [UnsupportedOperationException] if the list is | 157 * Throws an [UnsupportedOperationException] if the list is |
156 * not extendable. | 158 * not extendable. |
157 * If [length] is 0, this method does not do anything. | 159 * If [length] is 0, this method does not do anything. |
| 160 * Throws an [IllegalArgumentException] if [length] is negative. |
158 * Throws an [IndexOutOfRangeException] if [start] or | 161 * Throws an [IndexOutOfRangeException] if [start] or |
159 * [:start + length:] are out of range. | 162 * [:start + length:] are out of range. |
160 */ | 163 */ |
161 void removeRange(int start, int length); | 164 void removeRange(int start, int length); |
162 | 165 |
163 /** | 166 /** |
164 * Inserts a new range in the list, starting from [start] to | 167 * Inserts a new range in the list, starting from [start] to |
165 * [:start + length:]. The entries are filled with [initialValue]. | 168 * [:start + length:]. The entries are filled with [initialValue]. |
166 * Throws an [UnsupportedOperationException] if the list is | 169 * Throws an [UnsupportedOperationException] if the list is |
167 * not extendable. | 170 * not extendable. |
168 * If [length] is 0, this method does not do anything. | 171 * If [length] is 0, this method does not do anything. |
| 172 * Throws an [IllegalArgumentException] if [length] is negative. |
169 * Throws an [IndexOutOfRangeException] if [start] or | 173 * Throws an [IndexOutOfRangeException] if [start] or |
170 * [:start + length:] are out of range. | 174 * [:start + length:] are out of range. |
171 */ | 175 */ |
172 void insertRange(int start, int length, [E initialValue]); | 176 void insertRange(int start, int length, [E initialValue]); |
173 } | 177 } |
OLD | NEW |