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

List.sort's one parameter can now be optional #5870

Closed
sethladd opened this issue Oct 15, 2012 · 1 comment
Closed

List.sort's one parameter can now be optional #5870

sethladd opened this issue Oct 15, 2012 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

I see the Comparable.compare is a static method you can give to sort:

main() {
  var fruits = <String>['bananas', 'apples', 'oranges'];
  fruits.sort(Comparable.compare);
  print(fruits);
}

It would be nice to make sort's parameter optional, and use Comparable.compare if a parameter is not provided:

sort([Comparator comparator]) // use Comparable.compare if no comparator is given

Then we can so this:

fruits.sort();

Which is a common case.

@lrhn
Copy link
Member

lrhn commented Oct 15, 2012

That was exactly the point of introducing Comparable.compare.
It will happen.
The problem that blocked it might not be relevant anyway.


Added Duplicate label.
Marked as being merged into #1235.
Marked this as being blocked by #4597.

@sethladd sethladd added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report labels Oct 15, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
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-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants