Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: runtime/lib/growable_array.dart

Issue 10970009: Add list.removeAt method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 5cb8a021d4ffc6f4eabb78a7ed18896e5279bfd7..abdbb9d4959258209678f6b858f8049ebe32c66f 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -8,6 +8,17 @@ class GrowableObjectArray<T> implements List<T> {
"GrowableObjectArray can only be allocated by the VM");
}
+ E removeAt(int index) {
+ E result = this[index];
+ Arrays.copy(this,
+ index + 1,
+ this,
+ index,
+ this.length - index - 1);
+ this.length = this.length - 1;
+ return result;
+ }
+
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
if (length < 0) {
throw new IllegalArgumentException("negative length $length");

Powered by Google App Engine
This is Rietveld 408576698