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

Unified Diff: sdk/lib/core/list.dart

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 1e10e864537f3c27883771a26154bcdaf8cec46f..f193c94c8d22859575e2d00872e7a0eeb9071b5c 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -189,7 +189,21 @@ abstract class List<E> implements Collection<E> {
void clear();
/**
- * Removes the element at position[index] from the list.
+ * Inserts the element at position [index] in the list.
+ *
+ * This increases the length of the list by one and moves all later elements
+ * up by one position.
+ *
+ * Throws an [ArgumentError] if [index] is not an [int].
srdjan 2013/03/04 00:53:47 That is not correct for checked mode.
Lasse Reichstein Nielsen 2013/03/04 09:06:02 I really prefer to just say "It's an error if ..."
floitsch 2013/03/05 17:51:58 The documentation had been copied from removeAt. d
+ * Throws an [RangeError] if the [index] does not point inside
srdjan 2013/03/04 00:53:47 s/an/a/
+ * the list, or at the position after the last element.
+ * Throws an [UnsupportedError], and doesn't remove the element,
Lasse Reichstein Nielsen 2013/03/04 09:06:02 No need to say that. That's what throwing an Unsup
+ * if the length of the list cannot be changed.
+ */
+ void insertAt(int index, E element);
+
+ /**
+ * Removes the element at position [index] from the list.
*
* This reduces the length of the list by one and moves all later elements
* down by one position.

Powered by Google App Engine
This is Rietveld 408576698