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

Minor List improvements #215

Closed
DartBot opened this issue Oct 24, 2011 · 10 comments
Closed

Minor List improvements #215

DartBot opened this issue Oct 24, 2011 · 10 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Oct 24, 2011

This issue was originally filed by alexey.v.var...@gmail.com


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:

  1. 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.

  2. 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).

  3. 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?

  4. 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?).

@DartBot
Copy link
Author

DartBot commented Oct 24, 2011

This comment was originally written by ngeoffray@google.com


Thanks Alexey for the feedback! Here's my take on the list:

  1. addLast is there because we have removeLast and last. I will document that add and addLast have the same behavior.

  2. This has been on my TODO list for a long time, and should be implemented soon.

  3. Not that there is no addFirst either. I'm not really fond of adding 'first' methods.

  4. Yes, setRange and copyFrom are close duplicates. We plan on removing copyFrom.


Set owner to ngeoffray@google.com.
Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Accepted labels.

@DartBot
Copy link
Author

DartBot commented Nov 18, 2011

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)?

@DartBot
Copy link
Author

DartBot commented Nov 21, 2011

This comment was originally written by alexey.v.var...@gmail.com


One more item, it makes sense to override inherited method filter with covariant return type:
List<E> filter(bool f(E element));

@DartBot
Copy link
Author

DartBot commented Jan 12, 2012

This comment was originally written by seane...@gmail.com


comment #­3 is filed as issue #2

@DartBot
Copy link
Author

DartBot commented Mar 20, 2012

This comment was originally written by ngeoffray@google.com


Set owner to jjb@google.com.
Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Jun 6, 2012

This comment was originally written by renggl...@gmail.com


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.

@efortuna
Copy link
Contributor

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.
(+ager since it's a corelib issue?)


cc @madsager.

@DartBot
Copy link
Author

DartBot commented Aug 6, 2012

This comment was originally written by @seaneagan


Regarding add/remove, the following scheme would make sense to me:

void addLast(E item);
void addFirst(E item);
void addAt(int index, E item);
E removeLast();
E removeFirst();
E removeAt(int index);

@DartBot
Copy link
Author

DartBot commented Aug 17, 2012

This comment was originally written by ngeoffray@google.com


Set owner to @lrhn.

@lrhn
Copy link
Member

lrhn commented Apr 18, 2013

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.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Apr 18, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
nex3 pushed a commit that referenced this issue Aug 31, 2016
copybara-service bot pushed a commit that referenced this issue May 1, 2023
…, 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 <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue May 3, 2023
…, 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 <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
copybara-service bot pushed a commit that referenced this issue Oct 5, 2023
…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 <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 11, 2023
…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 <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@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
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants