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 class _GrowableObjectArray<T> implements List<T> { | 5 class _GrowableObjectArray<T> implements List<T> { |
6 factory _GrowableObjectArray._uninstantiable() { | 6 factory _GrowableObjectArray._uninstantiable() { |
7 throw const UnsupportedOperationException( | 7 throw new StateError( |
floitsch
2012/10/23 12:50:32
why can StateError not be const?
Lasse Reichstein Nielsen
2012/10/24 12:32:15
We don't want to fill our constant pool with excep
| |
8 "GrowableObjectArray can only be allocated by the VM"); | 8 "GrowableObjectArray can only be allocated by the VM"); |
9 } | 9 } |
10 | 10 |
11 T removeAt(int index) { | 11 T removeAt(int index) { |
12 if (index is! int) throw new ArgumentError(index); | 12 if (index is! int) throw new ArgumentError(index); |
13 T result = this[index]; | 13 T result = this[index]; |
14 int newLength = this.length - 1; | 14 int newLength = this.length - 1; |
15 Arrays.copy(this, | 15 Arrays.copy(this, |
16 index + 1, | 16 index + 1, |
17 this, | 17 this, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 } | 212 } |
213 | 213 |
214 String toString() { | 214 String toString() { |
215 return Collections.collectionToString(this); | 215 return Collections.collectionToString(this); |
216 } | 216 } |
217 | 217 |
218 Iterator<T> iterator() { | 218 Iterator<T> iterator() { |
219 return new SequenceIterator<T>(this); | 219 return new SequenceIterator<T>(this); |
220 } | 220 } |
221 } | 221 } |
OLD | NEW |