-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Minor List improvements #215
Comments
This comment was originally written by [email protected] Thanks Alexey for the feedback! Here's my take on the list:
Set owner to [email protected]. |
This comment was originally written by @mdakin Any plan to add a method for inserting an element to an arbitrary location as mentioned in first item: void add(E value, int index)? |
This comment was originally written by [email protected] One more item, it makes sense to override inherited method filter with covariant return type: |
This comment was originally written by [email protected] comment #3 is filed as issue #2 |
This comment was originally written by [email protected] Set owner to [email protected]. |
This comment was originally written by [email protected] I vote for adding addFirst(E value), add(E value, int index), removeFirst() and remove(int index). All these are easy to implement in terms of insertRange(int start, int length, [initialValue]) and removeRange(int start, int length), but just way to cumbersome to repeatedly do in user-code. |
addLast has still never been documented to have the same behavior. Can we add this documentation and/or (better yet) remove addLast? Having both add and addLast simply because we have removeLast and last seems silly. cc @madsager. |
This comment was originally written by @seaneagan Regarding add/remove, the following scheme would make sense to me: void addLast(E item); |
This comment was originally written by [email protected] Set owner to @lrhn. |
Almost all points here have been addressed now, many in the last library pass. We do not plan to add removeFirst, but we do have removeAt. Added Fixed label. |
…, tools, watcher Revisions updated by `dart tools/rev_sdk_deps.dart`. ffi (https://github.com/dart-lang/ffi/compare/04fa38a..6d8fa8d): 6d8fa8d 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#191) lints (https://github.com/dart-lang/lints/compare/f09399a..ba7d75e): ba7d75e 2023-04-26 Phil Quitslund 2.1.0 (#107) e6b82b6 2023-04-26 Devon Carew Update lint-propoposal.md (#115) markdown (https://github.com/dart-lang/markdown/compare/5f98aea..82b050d): 82b050d 2023-04-30 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#536) matcher (https://github.com/dart-lang/matcher/compare/cb6b68c..7228c26): 7228c26 2023-04-27 dependabot[bot] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#215) mockito (https://github.com/dart-lang/mockito/compare/f851e17..beb45ba): beb45ba 2023-04-26 yanok Remove unused local variable d2e155f 2023-04-26 yanok Require Dart SDK >= 2.19 b777874 2023-04-26 yanok First part of Dart3 support in Mockito ad3c9ae 2023-04-26 yanok Fix the type variable capture problem 6c448b2 2023-04-25 oprypin Keep generated mock files at language version 2.19 06f353e 2023-04-13 nbosch Deprecate the mixingIn argument to MockSpec f3ecdad 2023-04-11 oprypin Fix violations of `prefer_final_locals`, `prefer_final_in_for_each` lints test (https://github.com/dart-lang/test/compare/c9a3138..b252463): b252463a 2023-05-01 dependabot[bot] Bump github/codeql-action from 2.2.9 to 2.3.2 (#2001) test_process (https://github.com/dart-lang/test_process/compare/946bc27..89c4fdc): 89c4fdc 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#42) tools (https://github.com/dart-lang/tools/compare/5c9f45c..516995e): 516995e 2023-04-28 Danny Tuppeny Change "plugins" to "extensions" for VS Code (#75) watcher (https://github.com/dart-lang/watcher/compare/00aa79b..6c0c838): 6c0c838 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#144) Change-Id: I36d0db7f41a26e3f1430b86eff5d63b8e65c1616 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300321 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Auto-Submit: Devon Carew <[email protected]>
…, html, http, lints, markdown, matcher, mockito, path, protobuf, shelf, source_maps, source_span, sync_http, test, test_reflective_loader, tools, usage, vector_math, webdriver, webkit_inspection_protocol, yaml_edit Revisions updated by `dart tools/rev_sdk_deps.dart`. args (https://github.com/dart-lang/args/compare/5ac2ba1..1864048): 1864048 2023-05-03 Devon Carew added package topics to the pubspec file (#242) db229fb 2023-05-02 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#241) bazel_worker (https://github.com/dart-lang/bazel_worker/compare/d5f8837..1b86d3c): 1b86d3c 2023-05-02 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#72) characters (https://github.com/dart-lang/characters/compare/b306414..2af6783): 2af6783 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#81) cli_util (https://github.com/dart-lang/cli_util/compare/6c318c2..7234f17): 7234f17 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#82) collection (https://github.com/dart-lang/collection/compare/9db854d..26e3e67): 26e3e67 2023-05-03 Lasse R.H. Nielsen Accept SDK version above 3.0. (#281) file (https://github.com/google/file.dart/compare/72a67c3..b905180): b905180 2023-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#212) 8158a35 2023-05-01 dependabot[bot] Bump actions/checkout from 3.3.0 to 3.5.2 (#218) html (https://github.com/dart-lang/html/compare/0438b26..5d87dc8): 5d87dc8 2023-05-03 Devon Carew added package topics to the pubspec file (#215) http (https://github.com/dart-lang/http/compare/877f134..f581ff7): f581ff7 2023-05-01 Nate Bosch Prepare to publish (#914) fa53651 2023-05-01 Brian Quinlan Document that RetryClient may consume a lot of memory (#915) lints (https://github.com/dart-lang/lints/compare/ba7d75e..17276ec): 17276ec 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#116) markdown (https://github.com/dart-lang/markdown/compare/82b050d..6db8fc1): 6db8fc1 2023-05-02 Jonas Finnemann Jensen Prepare 7.1.0 (#538) matcher (https://github.com/dart-lang/matcher/compare/7228c26..5890f2b): 5890f2b 2023-05-01 Nate Bosch Expand bound for `test_api` dependency (#219) mockito (https://github.com/dart-lang/mockito/compare/beb45ba..56173fa): 56173fa 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#626) path (https://github.com/dart-lang/path/compare/23e3319..1552cfd): 1552cfd 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#142) 82ddc60 2023-05-01 Jonathan fixed mistake in split method doc comment (#141) protobuf (https://github.com/dart-lang/protobuf/compare/b90a4c4..9d7cf0d): 9d7cf0d 2023-05-01 Kevin Moore Update Github Actions (#827) shelf (https://github.com/dart-lang/shelf/compare/9a792b4..79e3cee): 79e3cee 2023-05-03 Devon Carew add package topics for package:shelf_router_generator (#346) 25861e5 2023-05-03 Devon Carew add topics to the pubspec files (#345) source_maps (https://github.com/dart-lang/source_maps/compare/0a4b030..f0a8506): f0a8506 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#77) source_span (https://github.com/dart-lang/source_span/compare/905a167..69fa991): 69fa991 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#97) sync_http (https://github.com/dart-lang/sync_http/compare/660ad87..c3d6ad4): c3d6ad4 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#36) test (https://github.com/dart-lang/test/compare/b252463..9484592): 9484592a 2023-05-02 Nate Bosch Prepare to publish checks (#2005) test_reflective_loader (https://github.com/dart-lang/test_reflective_loader/compare/a85a930..d1b763f): d1b763f 2023-05-01 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#48) tools (https://github.com/dart-lang/tools/compare/516995e..b55f0d4): b55f0d4 2023-05-02 Elias Yishak `pddFlag` removal + tests for pdd restricted instance of `Analytics` (#86) usage (https://github.com/dart-lang/usage/compare/f97752f..929a4e3): 929a4e3 2023-05-02 dependabot[bot] Bump actions/checkout from 3.5.0 to 3.5.2 (#193) vector_math (https://github.com/google/vector_math.dart/compare/7dec984..e3de8da): e3de8da 2023-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#291) webdriver (https://github.com/google/webdriver.dart/compare/562aa06..d0f78d0): d0f78d0 2023-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#273) 1ef3348 2023-05-01 dependabot[bot] Bump actions/checkout from 3.3.0 to 3.5.2 (#275) webkit_inspection_protocol (https://github.com/google/webkit_inspection_protocol.dart/compare/8401098..39a3c29): 39a3c29 2023-05-01 dependabot[bot] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#102) 5555c53 2023-05-01 dependabot[bot] Bump nanasess/setup-chromedriver from 1.1.0 to 2.0.0 (#101) 9adce2a 2023-05-01 dependabot[bot] Bump actions/checkout from 3.3.0 to 3.5.2 (#103) yaml_edit (https://github.com/dart-lang/yaml_edit/compare/5f392a1..e05282b): e05282b 2023-05-02 Jonas Finnemann Jensen Prepare 2.1.1 release (#52) Change-Id: Iee7fd84d32ae37b76147d62c2268df19cf8db95b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300863 Reviewed-by: Konstantin Shcheglov <[email protected]> Auto-Submit: Devon Carew <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
…pto, ffi, fixnum, markdown, matcher, mime, mockito, native, path, pool, sse, stack_trace, stream_channel, string_scanner, term_glyph, test_process, watcher Revisions updated by `dart tools/rev_sdk_deps.dart`. boolean_selector (https://github.com/dart-lang/boolean_selector/compare/9431e01..479e1c1): 479e1c1 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#52) browser_launcher (https://github.com/dart-lang/browser_launcher/compare/25bc94a..c2871b2): c2871b2 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#49) cli_util (https://github.com/dart-lang/cli_util/compare/9e48f0d..56c1235): 56c1235 2023-10-03 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#89) convert (https://github.com/dart-lang/convert/compare/140b2f0..03242b2): 03242b2 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#88) crypto (https://github.com/dart-lang/crypto/compare/b38dd62..36ead7c): 36ead7c 2023-10-03 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#154) ffi (https://github.com/dart-lang/ffi/compare/ee70dd4..2faec28): 2faec28 2023-10-02 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#215) fixnum (https://github.com/dart-lang/fixnum/compare/ef0a587..ef45eb5): ef45eb5 2023-10-02 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#116) markdown (https://github.com/dart-lang/markdown/compare/ae766d5..4e2e970): 4e2e970 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#557) matcher (https://github.com/dart-lang/matcher/compare/11daad9..356e5f6): 356e5f6 2023-10-03 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#228) mime (https://github.com/dart-lang/mime/compare/f3b9c49..af3e5fe): af3e5fe 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#106) mockito (https://github.com/dart-lang/mockito/compare/610c3dc..49859e4): 49859e4 2023-10-05 Ilya Yanok Fix Mockito formatting for recent Dart versions native (https://github.com/dart-lang/native/compare/7aaa025..fd21f5b): fd21f5b 2023-10-05 Gabriel Terwesten [native_assets_cli] Clarify meaning of `targetAndroidNdkApi` in docs (#151) path (https://github.com/dart-lang/path/compare/abcf38c..4ca27d4): 4ca27d4 2023-10-03 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#152) pool (https://github.com/dart-lang/pool/compare/4bcc7de..5ccef15): 5ccef15 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#74) sse (https://github.com/dart-lang/sse/compare/606387e..e190744): e190744 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#90) stack_trace (https://github.com/dart-lang/stack_trace/compare/1c36cd7..634589f): 634589f 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#142) stream_channel (https://github.com/dart-lang/stream_channel/compare/bf74065..ffdb208): ffdb208 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#96) string_scanner (https://github.com/dart-lang/string_scanner/compare/616424c..9c525f7): 9c525f7 2023-10-03 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#64) term_glyph (https://github.com/dart-lang/term_glyph/compare/19abf84..cff80de): cff80de 2023-10-02 dependabot[bot] Bump actions/checkout from 3.6.0 to 4.1.0 (#43) test_process (https://github.com/dart-lang/test_process/compare/5efd0bf..d610333): d610333 2023-10-02 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#48) watcher (https://github.com/dart-lang/watcher/compare/c480e2d..3998cdd): 3998cdd 2023-10-03 dependabot[bot] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#152) Change-Id: If3a7412a341d968ec8eee3a866f9f6149460c2c8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329580 Commit-Queue: Konstantin Shcheglov <[email protected]> Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
…h, protobuf, sync_http, test, tools, web, webdev Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/79a1bc5..ce707fb): ce707fb 2023-12-06 Moritz Use Flutter in `health.yaml` (#206) fixnum (https://github.com/dart-lang/fixnum/compare/6b0888c..3e08c0d): 3e08c0d 2023-12-04 Kevin Moore drop outdated lints (#123) http_parser (https://github.com/dart-lang/http_parser/compare/1cf5b7c..224c1a9): 224c1a9 2023-12-04 Kevin Moore drop outdated lints (#82) leak_tracker (https://github.com/dart-lang/leak_tracker/compare/a618a55..8644f8b): 8644f8b 2023-12-11 Lucas.Xu chore: bump leak_tracking_flutter_testing version to 1.0.12-wip (#192) cac195d 2023-12-11 Binni Goel Fix. typos in leak_tracker (#189) 9fd7932 2023-12-11 Lucas.Xu fix: add missing on leak callback (#190) 1ab3140 2023-12-08 Lucas.Xu chore: refactor code style (#186) mockito (https://github.com/dart-lang/mockito/compare/fb8a2b5..57a7c82): 57a7c82 2023-12-06 Copybara-Service Merge pull request #721 from Sese-Schneider:master c5de658 2023-12-06 Sese Schneider Apply suggestions from code review 1a652b8 2023-11-21 Sebastian Schneider Use `posix` style for local imports path (https://github.com/dart-lang/path/compare/18ec71f..115ea2a): 115ea2a 2023-12-05 Devon Carew rev the version of lints used; prep for publishing (#155) protobuf (https://github.com/dart-lang/protobuf/compare/bb19774..20ec685): 20ec685 2023-12-05 Ömer Sinan Ağacan Small PbList improvements (#906) sync_http (https://github.com/dart-lang/sync_http/compare/d8e9f3d..f96db95): f96db95 2023-12-05 Kevin Moore Latest lints, require Dart 3.0, use mini-libraries (#42) test (https://github.com/dart-lang/test/compare/9fffb48..43ff5bf): 43ff5bf9 2023-12-11 Ömer Sinan Ağacan Fix Dart2Wasm spelling (#2155) 7d61eef9 2023-12-08 Derek Xu Update frontend_server_client constraint to allow version 4.0.0 (#2153) 001c5381 2023-12-07 Jacob MacDonald fix precompiled vm tests loaded from a package: uri (#2152) fb3b5725 2023-12-05 Nate Bosch Use package: URIs for imports when possible (#2148) 03cc56ec 2023-12-05 Jacob MacDonald mark flaky windows test as skipped (#2151) 6e7e4fa8 2023-12-05 Jacob MacDonald Add regression test for relative imports in tests under `lib` (#2147) 84c366a7 2023-12-05 Jacob MacDonald fix broken tests (#2149) e49ae54b 2023-12-05 Jacob MacDonald Promote dart2wasm compiler support to the stable browser platform. (#2144) tools (https://github.com/dart-lang/tools/compare/c63dcb5..ed81684): ed81684 2023-12-06 Elias Yishak Fix consent message formatting (#215) c4d515a 2023-12-05 Elias Yishak Enum + event added for `commandUsageValues` (#211) web (https://github.com/dart-lang/web/compare/865aeaf..acf0beb): acf0beb 2023-12-07 Devon Carew fixes to the return types of several Node helper extension methods (#121) 9d7b33e 2023-12-06 Srujan Gaddam Handle Dart SDK change to extension types (#116) 0ae45ec 2023-12-05 Devon Carew Update README.md (#117) 34b3618 2023-12-05 Devon Carew have web.dart export the helpers; deprecate helpers.dart (#115) webdev (https://github.com/dart-lang/webdev/compare/63e09e5..8375cd6): 8375cd66 2023-12-08 Elliott Brooks Add popup for copying the app ID (#2299) Change-Id: Ibf5f5eca74c56bf31d50bddabbe9da2a2e6fd716 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341021 Commit-Queue: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
This issue was originally filed by [email protected]
The declarations of methods of corelibrary interface List
(http://dart.googlecode.com/svn/trunk/dart/corelib/src/list.dart) have some space for local improvements, w/o seriously affecting semantics.
Below is a list of suggestions, by order of appearance:
add(E value) duplicates addLast(E value). It would be more justified if declared as void add(E value, int index); allowing to insert an entry at arbitrary index.
indexOf(E element, int startIndex) & lastIndexOf(E element, int startIndex): the last parameter could be optional, with the semantics to search the whole list if omitted (from the list start or list end, respectively).
There are removeLast() and last() methods, but no first() and removeFirst() ones. The latter might be unwanted for library design reasons, but it would be more symmetrical to have a first() one?
void copyFrom(List<Object> src, int srcStart, int dstStart, int count);
and
void setRange(int start, int length, List<E> from, [int startFrom]);
seem to be close duplicates (except the generic type parameter of the source list). Please clarify the difference in docs or remove one of them (the first?).
The text was updated successfully, but these errors were encountered: