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

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

Issue 27308003: Document that concurrent modification is bad, m'kay. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cannot be misread as iterating changing the length. Created 7 years, 2 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
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/core/map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 34aefca97b0be729e031833edf93a626bd494664..a71dc11eb4f7a2c2f93f11182c923b0365020bb2 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -35,6 +35,13 @@ part of dart.core;
* lists can throw ConcurrentModificationError. If the length changes
* temporarily and is restored before continuing the iteration, the iterator
* does not detect it.
+ *
+ * It is generally not allowed to modify the list's length (adding or removing
+ * elements) while an operation on the list is being performed,
+ * for example during a call to [forEach] or [sort].
+ * Changing the list's length while it is being iterated, either by iterating it
+ * directly or through iterating an `Iterable` that is backed by the list, will
+ * break the iteration.
*/
abstract class List<E> implements Iterable<E>, EfficientLength {
/**
@@ -44,7 +51,7 @@ abstract class List<E> implements Iterable<E>, EfficientLength {
*
* List fixedLengthList = new List(3);
* fixedLengthList.length; // 3
- fixedLengthList.length = 1; // Error
+ * fixedLengthList.length = 1; // Error
*
*
* The list has length 0 and is growable if [length] is omitted.
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/core/map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698