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: make comparator optional for Comparables #3432

Closed
DartBot opened this issue Jun 7, 2012 · 2 comments
Closed

List.sort: make comparator optional for Comparables #3432

DartBot opened this issue Jun 7, 2012 · 2 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Jun 7, 2012

This issue was originally filed by dha...@google.com


If I have a list of numbers or dates or something that has a sensible default ordering, I should be able to call list.sort() and get the sorted list.

Making this work on arbitrary items could go several ways.

Option 1: make a consistent, but arbitrary ordering for lists with heterogeneous or non-comparable elements. This will violate expectations in that two items might be structurally equal but not compare equal; they might sport a .equals method or override the equality operators, but not override comparison operators; and two lists with equal members might end up sorted in different orders.

Option 2: throw an exception. This would be for any list with a real element type that does not extend Comparable. Possibly for a List<Dynamic>, you could hope that all elements are mutually comparable and sort anyway.

@DartBot
Copy link
Author

DartBot commented Jun 7, 2012

This comment was originally written by @seaneagan


duplicate of issue #1235

@dgrove
Copy link
Contributor

dgrove commented Jun 8, 2012

Added Duplicate label.
Marked as being merged into #1235.

@DartBot DartBot added Type-Defect closed-duplicate Closed in favor of an existing report labels Jun 8, 2012
copybara-service bot pushed a commit that referenced this issue Jun 8, 2023
…, typed_data

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/449478c..2a39574):
  2a395741  2023-06-07  Sam Rawlins  Seal mustachio nodes (#3433)
  d5bb24b2  2023-06-07  Sam Rawlins  Convert Tuples to Records and split a helper out from findCanonicalModelElementFor (#3432)

http_parser (https://github.com/dart-lang/http_parser/compare/1ef3e56..19466c0):
  19466c0  2023-06-07  Kevin Moore  Require Dart 3.0, update lints (#74)

leak_tracker (https://github.com/dart-lang/leak_tracker/compare/f17da61..fc45bec):
  fc45bec  2023-06-07  Polina Cherkasova  Break the leak tracker code to packages. (#80)

path (https://github.com/dart-lang/path/compare/f8d15c2..592505f):
  592505f  2023-06-07  Kevin Moore  Require Dart 3.0, update lints (#146)

pool (https://github.com/dart-lang/pool/compare/a10a0f9..c6b1b2c):
  c6b1b2c  2023-06-07  Kevin Moore  Require Dart 3.0, update lints (#71)

term_glyph (https://github.com/dart-lang/term_glyph/compare/9d8956f..4daa34e):
  4daa34e  2023-06-07  Kevin Moore  Require Dart 3.0, update lints (#39)

typed_data (https://github.com/dart-lang/typed_data/compare/693f48e..8d29573):
  8d29573  2023-06-07  Kevin Moore  Require Dart 3.0, update lints (#67)

Change-Id: I11fe765858ba970f13a2051abee34abf910f4698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308161
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants