Chromium Code Reviews

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

Issue 26280002: Set.add returns true if item has been added, otherwise false (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: docs Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/collection_patch.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 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
(...skipping 35 matching lines...)
46 * have a compatible [Object.hashCode] implementation. 46 * have a compatible [Object.hashCode] implementation.
47 */ 47 */
48 factory Set.from(Iterable<E> other) = LinkedHashSet<E>.from; 48 factory Set.from(Iterable<E> other) = LinkedHashSet<E>.from;
49 49
50 /** 50 /**
51 * Returns true if [value] is in the set. 51 * Returns true if [value] is in the set.
52 */ 52 */
53 bool contains(Object value); 53 bool contains(Object value);
54 54
55 /** 55 /**
56 * Adds [value] into the set. 56 * Adds [value] into the set. Returns `true` if [value] was added to the set.
Lasse Reichstein Nielsen 2013/10/08 12:35:03 Put "Returns ..." sentence at the end of the dartd
57 * 57 *
58 * The method has no effect if [value] is already in the set. 58 * If [value] already exists, the set is not changed and `false` is returned.
59 */ 59 */
60 void add(E value); 60 bool add(E value);
61 61
62 /** 62 /**
63 * Adds all of [elements] to this Set. 63 * Adds all of [elements] to this Set.
64 * 64 *
65 * Equivalent to adding each element in [elements] using [add], 65 * Equivalent to adding each element in [elements] using [add],
66 * but some collections may be able to optimize it. 66 * but some collections may be able to optimize it.
67 */ 67 */
68 void addAll(Iterable<E> elements); 68 void addAll(Iterable<E> elements);
69 69
70 /** 70 /**
(...skipping 50 matching lines...)
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
« no previous file with comments | « sdk/lib/_internal/lib/collection_patch.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine