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

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

Issue 14246008: Allow Object when doing lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« sdk/lib/core/map.dart ('K') | « 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 * This class is the public interface of a set. A set is a collection 8 * This class is the public interface of a set. A set is a collection
9 * without duplicates. 9 * without duplicates.
10 */ 10 */
11 abstract class Set<E> extends IterableBase<E> { 11 abstract class Set<E> extends IterableBase<E> {
12 factory Set() => new HashSet<E>(); 12 factory Set() => new HashSet<E>();
13 13
14 /** 14 /**
15 * Creates a [Set] that contains all elements of [other]. 15 * Creates a [Set] that contains all elements of [other].
16 */ 16 */
17 factory Set.from(Iterable<E> other) => new HashSet<E>.from(other); 17 factory Set.from(Iterable<E> other) => new HashSet<E>.from(other);
18 18
19 /** 19 /**
20 * Returns true if [value] is in the set. 20 * Returns true if [value] is in the set.
21 */ 21 */
22 bool contains(E value); 22 bool contains(Object value);
23 23
24 /** 24 /**
25 * Adds [value] into the set. The method has no effect if 25 * Adds [value] into the set. The method has no effect if
26 * [value] was already in the set. 26 * [value] was already in the set.
27 */ 27 */
28 void add(E value); 28 void add(E value);
29 29
30 /** 30 /**
31 * Adds all of [elements] to this Set. 31 * Adds all of [elements] to this Set.
32 * 32 *
33 * Equivalent to adding each element in [elements] using [add], 33 * Equivalent to adding each element in [elements] using [add],
34 * but some collections may be able to optimize it. 34 * but some collections may be able to optimize it.
35 */ 35 */
36 void addAll(Iterable<E> elements); 36 void addAll(Iterable<E> elements);
37 37
38 /** 38 /**
39 * Removes [value] from the set. Returns true if [value] was 39 * Removes [value] from the set. Returns true if [value] was
40 * in the set. Returns false otherwise. The method has no effect 40 * in the set. Returns false otherwise. The method has no effect
41 * if [value] value was not in the set. 41 * if [value] value was not in the set.
42 */ 42 */
43 bool remove(Object value); 43 bool remove(Object value);
44 44
45 /** 45 /**
46 * Removes all of [elements] from this set. 46 * Removes all of [elements] from this set.
47 */ 47 */
48 void removeAll(Iterable elements); 48 void removeAll(Iterable elements);
Lasse Reichstein Nielsen 2013/04/24 09:11:18 Iterable<Object>?
floitsch 2013/06/17 18:25:34 Done.
49 49
50 /** 50 /**
51 * Removes all elements of this set that are not 51 * Removes all elements of this set that are not
52 * in [elements]. 52 * in [elements].
53 */ 53 */
54 void retainAll(Iterable elements); 54 void retainAll(Iterable elements);
Lasse Reichstein Nielsen 2013/04/24 09:11:18 Make this Iterable<Object> to match?
floitsch 2013/06/17 18:25:34 Done.
55 55
56 /** 56 /**
57 * Removes all elements of this set that satisfy [test]. 57 * Removes all elements of this set that satisfy [test].
58 */ 58 */
59 void removeWhere(bool test(E element)); 59 void removeWhere(bool test(E element));
60 60
61 /** 61 /**
62 * Removes all elements of this set that fail to satisfy [test]. 62 * Removes all elements of this set that fail to satisfy [test].
63 */ 63 */
64 void retainWhere(bool test(E element)); 64 void retainWhere(bool test(E element));
65 65
66 /** 66 /**
67 * Returns true if this Set contains all the elements of [other]. 67 * Returns true if this Set contains all the elements of [other].
68 */ 68 */
69 bool containsAll(Iterable<E> other); 69 bool containsAll(Iterable<Object> other);
70 70
71 /** 71 /**
72 * Returns a new set which is the intersection between this set and [other]. 72 * Returns a new set which is the intersection between this set and [other].
73 */ 73 */
74 Set<E> intersection(Set<E> other); 74 Set<E> intersection(Set<E> other);
Lasse Reichstein Nielsen 2013/04/24 09:11:18 Should this be Set<Object> other?
floitsch 2013/06/17 18:25:34 Done.
75 75
76 /** 76 /**
77 * Returns a new set which contains all the elements of this set and [other]. 77 * Returns a new set which contains all the elements of this set and [other].
78 */ 78 */
79 Set<E> union(Set<E> other); 79 Set<E> union(Set<E> other);
80 80
81 /** 81 /**
82 * Returns a new set with the the elements of this that are not in [other]. 82 * Returns a new set with the the elements of this that are not in [other].
83 */ 83 */
84 Set<E> difference(Set<E> other); 84 Set<E> difference(Set<E> other);
85 85
86 /** 86 /**
87 * Removes all elements in the set. 87 * Removes all elements in the set.
88 */ 88 */
89 void clear(); 89 void clear();
90 } 90 }
OLDNEW
« sdk/lib/core/map.dart ('K') | « sdk/lib/core/map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698