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

Side by Side Diff: sdk/lib/core/set.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/map.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A collection of objects in which each object can occur only once. 8 * A collection of objects in which each object can occur only once.
9 * 9 *
10 * That is, for each object of the element type, the object is either considered 10 * That is, for each object of the element type, the object is either considered
11 * to be in the set, or to _not_ be in the set. 11 * to be in the set, or to _not_ be in the set.
12 * 12 *
13 * Set implementations may consider some elements indistinguishable. These 13 * Set implementations may consider some elements indistinguishable. These
14 * elements are treated as being the same for any operation on the set. 14 * elements are treated as being the same for any operation on the set.
15 * 15 *
16 * The default `Set` implementation, [HashSet], considers objects 16 * The default `Set` implementation, [HashSet], considers objects
17 * indistinguishable if they are equal with regard to [Object.operator==]. 17 * indistinguishable if they are equal with regard to [Object.operator==].
18 * 18 *
19 * Sets may be either ordered or unordered. [HashSet] is unordered and doesn't 19 * Sets may be either ordered or unordered. [HashSet] is unordered and doesn't
20 * guarantee anything about the order that elements are accessed in by 20 * guarantee anything about the order that elements are accessed in by
21 * iteration. [LinkedHashSet] iterates in the insertion order of its elements. 21 * iteration. [LinkedHashSet] iterates in the insertion order of its elements.
22 *
23 * It is generally not allowed to modify the set (add or remove elements) while
24 * an operation on the set is being performed, for example during a call to
25 * [forEach] or [containsAll]. Nor is it allowed to modify the set while
26 * iterating either the set itself or any `Iterable` that is backed by the set,
27 * such as the ones returned by methods like [where] and [map].
22 */ 28 */
23 abstract class Set<E> extends IterableBase<E> implements EfficientLength { 29 abstract class Set<E> extends IterableBase<E> implements EfficientLength {
24 /** 30 /**
25 * Creates an empty [Set]. 31 * Creates an empty [Set].
26 * 32 *
27 * The created `Set` is a [LinkedHashSet]. As such, it considers elements that 33 * The created `Set` is a [LinkedHashSet]. As such, it considers elements that
28 * are equal (using `==`) to be indistinguishable, and requires them to 34 * are equal (using `==`) to be indistinguishable, and requires them to
29 * have a compatible [Object.hashCode] implementation. 35 * have a compatible [Object.hashCode] implementation.
30 */ 36 */
31 factory Set() = LinkedHashSet<E>; 37 factory Set() = LinkedHashSet<E>;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 * That is, the returned set contains all the elements of this `Set` that 135 * That is, the returned set contains all the elements of this `Set` that
130 * are not elements of [other]. 136 * are not elements of [other].
131 */ 137 */
132 Set<E> difference(Set<E> other); 138 Set<E> difference(Set<E> other);
133 139
134 /** 140 /**
135 * Removes all elements in the set. 141 * Removes all elements in the set.
136 */ 142 */
137 void clear(); 143 void clear();
138 } 144 }
OLDNEW
« no previous file with comments | « sdk/lib/core/map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698