Chromium Code Reviews| 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> default ListImplementation<E> { | 9 interface List<E> extends Collection<E> default ListImplementation<E> { |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 */ | 88 */ |
| 89 int lastIndexOf(E element, [int start]); | 89 int lastIndexOf(E element, [int start]); |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * Removes all elements in the list. The length of the list | 92 * Removes all elements in the list. The length of the list |
| 93 * becomes zero. Throws an [UnsupportedOperationException] if | 93 * becomes zero. Throws an [UnsupportedOperationException] if |
| 94 * the list is not extendable. | 94 * the list is not extendable. |
| 95 */ | 95 */ |
| 96 void clear(); | 96 void clear(); |
| 97 | 97 |
| 98 /** | |
| 99 * Removes the element at position[index] from the list. | |
|
ngeoffray
2012/09/20 09:16:24
FYI: we did not have removeAt initially because it
Lasse Reichstein Nielsen
2012/09/20 10:50:29
Performance through inconvenience :)
I don't think
| |
| 100 * | |
| 101 * This reduces the length of the list by one and moves | |
| 102 * all later elements down by one position. | |
| 103 * Returns the removed element. | |
| 104 * Throws a [UnsupportedOperationException] if the list, or the | |
| 105 * length of the list, cannot be changed. | |
| 106 */ | |
| 107 E removeAt(int index); | |
| 108 | |
| 98 /** | 109 /** |
| 99 * Pops and returns the last element of the list. | 110 * Pops and returns the last element of the list. |
| 100 * Throws a [UnsupportedOperationException] if the length of the | 111 * Throws a [UnsupportedOperationException] if the length of the |
| 101 * list cannot be changed. | 112 * list cannot be changed. |
| 113 * | |
| 102 */ | 114 */ |
| 103 E removeLast(); | 115 E removeLast(); |
| 104 | 116 |
| 105 /** | 117 /** |
| 106 * Returns the last element of the list, or throws an out of bounds | 118 * Returns the last element of the list, or throws an out of bounds |
| 107 * exception if the list is empty. | 119 * exception if the list is empty. |
| 108 */ | 120 */ |
| 109 E last(); | 121 E last(); |
| 110 | 122 |
| 111 /** | 123 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 * not extendable. | 159 * not extendable. |
| 148 * If [length] is 0, this method does not do anything. | 160 * If [length] is 0, this method does not do anything. |
| 149 * If [start] is the length of the list, this method inserts the | 161 * If [start] is the length of the list, this method inserts the |
| 150 * range at the end of the list. | 162 * range at the end of the list. |
| 151 * Throws an [IllegalArgumentException] if [length] is negative. | 163 * Throws an [IllegalArgumentException] if [length] is negative. |
| 152 * Throws an [IndexOutOfRangeException] if [start] is negative or if | 164 * Throws an [IndexOutOfRangeException] if [start] is negative or if |
| 153 * [start] is greater than the length of the list. | 165 * [start] is greater than the length of the list. |
| 154 */ | 166 */ |
| 155 void insertRange(int start, int length, [E initialValue]); | 167 void insertRange(int start, int length, [E initialValue]); |
| 156 } | 168 } |
| OLD | NEW |