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

Side by Side Diff: corelib/src/set.dart

Issue 10836009: Change Set.add to return a boolean indicating success. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « corelib/src/implementation/hash_map_set.dart ('k') | tests/corelib/set_test.dart » ('j') | 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 /** 5 /**
6 * This class is the public interface of a set. A set is a collection 6 * This class is the public interface of a set. A set is a collection
7 * without duplicates. 7 * without duplicates.
8 */ 8 */
9 interface Set<E> extends Collection<E> 9 interface Set<E> extends Collection<E>
10 default HashSetImplementation<E extends Hashable> { 10 default HashSetImplementation<E extends Hashable> {
11 Set(); 11 Set();
12 12
13 /** 13 /**
14 * Creates a [Set] that contains all elements of [other]. 14 * Creates a [Set] that contains all elements of [other].
15 */ 15 */
16 Set.from(Iterable<E> other); 16 Set.from(Iterable<E> other);
17 17
18 /** 18 /**
19 * Returns true if [value] is in the set. 19 * Returns true if [value] is in the set.
20 */ 20 */
21 bool contains(E value); 21 bool contains(E value);
22 22
23 /** 23 /**
24 * Adds [value] into the set. The method has no effect if 24 * Adds [value] into the set. Returns true if [value] was not in the set.
25 * [value] was already in the set. 25 * The method has no effect if [value] was already in the set.
26 */ 26 */
27 void add(E value); 27 bool add(E value);
28 28
29 /** 29 /**
30 * Removes [value] from the set. Returns true if [value] was 30 * Removes [value] from the set. Returns true if [value] was
31 * in the set. Returns false otherwise. The method has no effect 31 * in the set. Returns false otherwise. The method has no effect
32 * if [value] value was not in the set. 32 * if [value] value was not in the set.
33 */ 33 */
34 bool remove(E value); 34 bool remove(E value);
35 35
36 /** 36 /**
37 * Adds all the elements of the given collection to the set. 37 * Adds all the elements of the given collection to the set.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 interface HashSet<E extends Hashable> extends Set<E> 71 interface HashSet<E extends Hashable> extends Set<E>
72 default HashSetImplementation<E extends Hashable> { 72 default HashSetImplementation<E extends Hashable> {
73 HashSet(); 73 HashSet();
74 74
75 /** 75 /**
76 * Creates a [Set] that contains all elements of [other]. 76 * Creates a [Set] that contains all elements of [other].
77 */ 77 */
78 HashSet.from(Iterable<E> other); 78 HashSet.from(Iterable<E> other);
79 } 79 }
OLDNEW
« no previous file with comments | « corelib/src/implementation/hash_map_set.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698