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

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

Issue 14173003: Remove Collection, Collections and clean up List/Set/Queue implementations of retain/remove. (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
« no previous file with comments | « sdk/lib/collection/queue.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.core;
6
7 /**
8 * A collection of individual elements.
9 *
10 * A [Collection] contains some elements in a structure optimized
11 * for certain operations. Different collections are optimized for different
12 * uses.
13 *
14 * A collection can be updated by adding or removing elements.
15 *
16 * Collections are [Iterable]. The order of iteration is defined by
17 * each type of collection.
18 *
19 * *Deprecated*: This class is deprecated and will be removed soon.
20 */
21 abstract class Collection<E> extends Iterable<E> {
22 const Collection();
23
24 /**
25 * Adds an element to this collection.
26 */
27 void add(E element);
28
29 /**
30 * Adds all of [elements] to this collection.
31 *
32 * Equivalent to adding each element in [elements] using [add],
33 * but some collections may be able to optimize it.
34 */
35 void addAll(Iterable<E> elements) {
36 for (E element in elements) {
37 add(element);
38 }
39 }
40
41 /**
42 * Removes an instance of [element] from this collection.
43 *
44 * This removes only one instance of the element for collections that can
45 * contain the same element more than once (e.g., [List]). Which instance
46 * is removed is decided by the collection.
47 *
48 * Has no effect if the elements is not in this collection.
49 */
50 void remove(Object element);
51
52 /**
53 * Removes all of [elements] from this collection.
54 *
55 * Equivalent to calling [remove] once for each element in
56 * [elements], but may be faster for some collections.
57 */
58 void removeAll(Iterable elements) {
59 IterableMixinWorkaround.removeAll(this, elements);
60 }
61
62 /**
63 * Removes all elements of this collection that are not
64 * in [elements].
65 *
66 * For [Set]s, this is the intersection of the two original sets.
67 */
68 void retainAll(Iterable elements) {
69 IterableMixinWorkaround.retainAll(this, elements);
70 }
71
72 /**
73 * Removes all elements of this collection that satisfy [test].
74 *
75 * An elements [:e:] satisfies [test] if [:test(e):] is true.
76 */
77 void removeWhere(bool test(E element)) {
78 IterableMixinWorkaround.removeWhere(this, test);
79 }
80
81 /**
82 * Removes all elements of this collection that fail to satisfy [test].
83 *
84 * An elements [:e:] satisfies [test] if [:test(e):] is true.
85 */
86 void retainWhere(bool test(E element)) {
87 IterableMixinWorkaround.retainWhere(this, test);
88 }
89
90 /**
91 * Removes all elements of this collection.
92 */
93 void clear() {
94 IterableMixinWorkaround.removeWhere(this, (E e) => true);
95 }
96 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/queue.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698