Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing unique() method on Iterable #8017

Closed
sethladd opened this issue Jan 22, 2013 · 1 comment
Closed

Missing unique() method on Iterable #8017

sethladd opened this issue Jan 22, 2013 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

I went looking for .unique() on iterable and I didn't find it. I have a list that I've mapped and I'd like to get the unique items.

I could create a Set and add all the items in there, but it's nice to be able to chain up these transforms:

collection.mappedBy().unique()

What is the canonical way to get a unique set of items from an iterable? I suppose I could write a reduce() to do it, but would like to see unique() :)

@DartBot
Copy link

DartBot commented Jan 23, 2013

This comment was originally written by @seaneagan


Hmmm, there is a toSet() already, but it's not lazy. Maybe replace toSet()/toList() with asSet()/asList() and then add a cache() method:

coll.mappedBy(f).asSet().cache();
coll.mappedBy(f).asList().cache();
coll.mappedBy(f).cache(); // if you don't care about the return type

@sethladd sethladd added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Jan 23, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@lrhn lrhn added the core-m label Aug 11, 2017
@floitschG floitschG added core-n and removed core-m labels Aug 29, 2017
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants