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

Side by Side Diff: lib/src/set_group.dart

Issue 1873373002: Add GroupSet and SetGroup classes. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: Add a disjoint parameter to SetGroup. Created 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2016, 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 import 'group_set.dart';
6 import 'wrappers.dart';
7
8 /// A set of sets that provides [set], a view of the union of those sets.
9 ///
10 /// This is a convenience class for creating a [GroupSet] whose contents change
11 /// over the lifetime of a class. For example:
12 ///
13 /// ```dart
14 /// class Foo {
15 /// Set<String> get contents => _contentsGroup.set;
16 /// final _contentsGroup = new SetGroup<String>();
17 ///
18 /// // ...
19 /// }
20 /// ```
21 class SetGroup<E> extends DelegatingSet<Set<E>> {
22 /// The [GroupSet] that provides a view of the union of sets in [this].
23 GroupSet<E> get set => _set;
24 GroupSet<E> _set;
25
26 /// Creates a set of sets that provides a view of the union of those sets.
27 ///
28 /// If [disjoint] is `true`, this assumes that all component sets are
29 /// disjoint—that is, that they contain no elements in common. This makes
30 /// many operations including [length] more efficient.
31 SetGroup({bool disjoint: false}) : super(new Set<Set<E>>()) {
32 _set = new GroupSet<E>(this, disjoint: disjoint);
33 }
34 }
OLDNEW
« lib/src/group_set.dart ('K') | « lib/src/group_set.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698