Chromium Code Reviews| Index: runtime/lib/growable_array.dart |
| diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart |
| index 52bced7530f0e787bc4a62c24874859ecc3b9669..39e35fdb049586f3f867094c0b8e11ecf73dcca0 100644 |
| --- a/runtime/lib/growable_array.dart |
| +++ b/runtime/lib/growable_array.dart |
| @@ -24,18 +24,29 @@ class _GrowableObjectArray<T> implements List<T> { |
| void remove(Object element) { |
| for (int i = 0; i < this.length; i++) { |
| if (this[i] == element) { |
| - int newLength = this.length - 1; |
| - Arrays.copy(this, |
| - index + 1, |
| - this, |
| - index, |
| - newLength - index); |
| - this.length = newLength; |
| + removeAt(i); |
|
Anders Johnsen
2013/01/24 09:40:46
Nice :)
|
| return; |
| } |
| } |
| } |
| + void removeAll(Iterable elements) { |
| + IterableMixinWorkaround.removeAllList(this, elements); |
| + } |
| + |
| + void retainAll(Iterable elements) { |
| + IterableMixinWorkaround.retainAll(this, elements); |
| + } |
| + |
| + void removeMatching(bool test(E element)) { |
| + IterableMixinWorkaround.removeMatchingList(this, test); |
| + } |
| + |
| + void retainMatching(bool test(T element)) { |
| + IterableMixinWorkaround.removeMatchingList(this, |
| + (T element) => !test(element)); |
| + } |
| + |
| void setRange(int start, int length, List<T> from, [int startFrom = 0]) { |
| if (length < 0) { |
| throw new ArgumentError("negative length $length"); |