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

Side by Side Diff: sdk/lib/core/set.dart

Issue 26681002: Add EfficientLength marker interface to some iterabels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 */ 22 */
23 abstract class Set<E> extends IterableBase<E> { 23 abstract class Set<E> extends IterableBase<E> implements EfficientLength {
24 /** 24 /**
25 * Creates an empty [Set]. 25 * Creates an empty [Set].
26 * 26 *
27 * The created `Set` is a [LinkedHashSet]. As such, it considers elements that 27 * The created `Set` is a [LinkedHashSet]. As such, it considers elements that
28 * are equal (using `==`) to be indistinguishable, and requires them to 28 * are equal (using `==`) to be indistinguishable, and requires them to
29 * have a compatible [Object.hashCode] implementation. 29 * have a compatible [Object.hashCode] implementation.
30 */ 30 */
31 factory Set() = LinkedHashSet<E>; 31 factory Set() = LinkedHashSet<E>;
32 32
33 /** 33 /**
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 * That is, the returned set contains all the elements of this `Set` that 121 * That is, the returned set contains all the elements of this `Set` that
122 * are not elements of [other]. 122 * are not elements of [other].
123 */ 123 */
124 Set<E> difference(Set<E> other); 124 Set<E> difference(Set<E> other);
125 125
126 /** 126 /**
127 * Removes all elements in the set. 127 * Removes all elements in the set.
128 */ 128 */
129 void clear(); 129 void clear();
130 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698