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

Issue 12646005: Add Set.union, Set.difference. Change Set methods to expect Set. (Closed)

Created:
7 years, 9 months ago by Lasse Reichstein Nielsen
Modified:
7 years, 9 months ago
Reviewers:
floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add Set.union, Set.difference. Change Set methods to expect Set. Previously the Set methods expected a Collection, which made no sense. Committed: https://code.google.com/p/dart/source/detail?r=19926

Patch Set 1 #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -80 lines) Patch
M sdk/lib/collection/hash_set.dart View 1 chunk +37 lines, -12 lines 2 comments Download
M sdk/lib/collection/linked_hash_set.dart View 1 chunk +37 lines, -12 lines 3 comments Download
M sdk/lib/core/iterable.dart View 1 chunk +5 lines, -0 lines 2 comments Download
M sdk/lib/core/set.dart View 1 chunk +17 lines, -8 lines 5 comments Download
M tests/corelib/set_test.dart View 6 chunks +65 lines, -48 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Lasse Reichstein Nielsen
7 years, 9 months ago (2013-03-12 11:29:25 UTC) #1
floitsch
LGTM (except iterable change). https://codereview.chromium.org/12646005/diff/1/sdk/lib/collection/hash_set.dart File sdk/lib/collection/hash_set.dart (right): https://codereview.chromium.org/12646005/diff/1/sdk/lib/collection/hash_set.dart#newcode89 sdk/lib/collection/hash_set.dart:89: bool isSubsetOf(Set<E> other) { bool ...
7 years, 9 months ago (2013-03-12 16:25:00 UTC) #2
Sean Eagan
On 2013/03/12 11:29:25, Lasse Reichstein Nielsen wrote: It seems like containsAll would be useful as ...
7 years, 9 months ago (2013-03-12 18:43:55 UTC) #3
Lasse Reichstein Nielsen
https://codereview.chromium.org/12646005/diff/1/sdk/lib/collection/hash_set.dart File sdk/lib/collection/hash_set.dart (right): https://codereview.chromium.org/12646005/diff/1/sdk/lib/collection/hash_set.dart#newcode89 sdk/lib/collection/hash_set.dart:89: bool isSubsetOf(Set<E> other) { The resason is the usual ...
7 years, 9 months ago (2013-03-13 13:01:42 UTC) #4
Lasse Reichstein Nielsen
Committed patchset #1 manually as r19926 (presubmit successful).
7 years, 9 months ago (2013-03-13 13:05:58 UTC) #5
Lasse Reichstein Nielsen
7 years, 9 months ago (2013-03-14 07:18:17 UTC) #6
Message was sent while issue was closed.
I don't think we will want lazy operations on Set that returns a Set.
If I were to add it, I'd make a LazySet class with
union/intersection/difference/symmetricDifference constructors, so you have to
be explicit about it.

The point about containsAll and isSubsetOf is good. We weren't looking at those
with an eye to change them, but we've decided to let containsAll allow any
Iterable. It's still only on Set since it really relies on a fast contains
method. At the same time we'll remove (starting by deprecating) the isSubsetOf
method.
That means that if you really want to do list.containsAll(otherList), you need
to convert the first list to a set first - which is what isSubsetOf currently
does anyway to avoid quadratic behavior.

So, thanks for the comments.

Powered by Google App Engine
This is Rietveld 408576698