Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Add flattenedToList and flattenedToSet #328

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Add flattenedToList and flattenedToSet #328

merged 3 commits into from
Jun 10, 2024

Conversation

natebosch
Copy link
Member

For iterables which are known to be exhausted after flattening
performance is better than the sync* implementation using a collection
literal.

Add flattenedToList as a performance improvement over flattened.
Add flattenedToSet as new behavior for flattening to unique elements.

Originally implemented in
dart-lang/sdk@8d3b6ce

For iterables which are known to be exhausted after flattening
performance is better than the `sync*` implementation using a collection
literal.

Add `flattenedToList` as a performance improvement over `flattened.`
Add `flattenedToSet` as new behavior for flattening to unique elements.

Originally implemented in
dart-lang/sdk@8d3b6ce
@natebosch
Copy link
Member Author

cc @scheglov - any concerns about landing this here? You might need to handle import conflicts when this version gets pulled in to the SDK.

@natebosch natebosch requested a review from lrhn January 12, 2024 04:28
@natebosch
Copy link
Member Author

I'm not sure if we want to hold this on #284 - we also have another new API on that branch waiting for publish.

test/extensions_test.dart Show resolved Hide resolved
@lrhn
Copy link
Member

lrhn commented Jan 12, 2024

If someone needs this, it's fine to release it in 2.X, and merge it into the 3.0 branch too.
Otherwise it's probably easier to just put it into the next major release.

I really should get back to releasing the 3.0 version.

@scheglov
Copy link
Contributor

cc @scheglov - any concerns about landing this here? You might need to handle import conflicts when this version gets pulled in to the SDK.

https://dart-review.googlesource.com/c/sdk/+/346163 renames these methods in the analyzer, so there will be no conflict. I will migrate once this PR lands, and package:collection is pulled into SDK.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jan 16, 2024
We might get it into package:collection
dart-lang/collection#328

So, I rename it in the analyzer to prevent future conflict.

Change-Id: I8cee41e76cb0f3c7147eda2b7284cec9f57aea92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346163
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
@kevmoo
Copy link
Member

kevmoo commented Jun 7, 2024

@natebosch – care to proceed?

@kevmoo kevmoo merged commit a1d2507 into master Jun 10, 2024
6 checks passed
@kevmoo kevmoo deleted the flattened-to-list branch June 10, 2024 21:14
mosuem pushed a commit to dart-lang/core that referenced this pull request Oct 18, 2024
For iterables which are known to be exhausted after flattening
performance is better than the `sync*` implementation using a collection
literal.

Add `flattenedToList` as a performance improvement over `flattened.`
Add `flattenedToSet` as new behavior for flattening to unique elements.

Originally implemented in
dart-lang/sdk@8d3b6ce
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants