Chromium Code Reviews| Index: runtime/lib/growable_array.dart |
| diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart |
| index 5759178e8609c68362b633b77af9dbea899808bf..3b5adc46bbd270dd79eaad0c0f6aa153d599f0da 100644 |
| --- a/runtime/lib/growable_array.dart |
| +++ b/runtime/lib/growable_array.dart |
| @@ -8,6 +8,22 @@ class _GrowableObjectArray<T> implements List<T> { |
| "GrowableObjectArray can only be allocated by the VM"); |
| } |
| + void insert(int index, T element) { |
| + if (index < 0 || index > length) throw new RangeError(index); |
|
Lasse Reichstein Nielsen
2013/03/07 09:57:53
new RangeError.range(index, 0, length)
floitsch
2013/03/07 12:53:53
Done.
|
| + if (index == this.length) { |
| + add(element); |
| + return; |
| + } |
| + int oldLength = this.length; |
| + this.length++; |
| + Arrays.copy(this, |
| + index, |
| + this, |
| + index + 1, |
| + oldLength - index); |
| + this[index] = element; |
| + } |
| + |
| T removeAt(int index) { |
| if (index is! int) throw new ArgumentError(index); |
| T result = this[index]; |