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

Add to Collection interface: hasElements or equivalent #3074

Closed
DartBot opened this issue May 16, 2012 · 9 comments
Closed

Add to Collection interface: hasElements or equivalent #3074

DartBot opened this issue May 16, 2012 · 9 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. 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

@DartBot
Copy link

DartBot commented May 16, 2012

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


The most used predicate over a collection is: does it have anything in it?

But the interface provides only "does it have nothing in it", i.e. isEmpty.

This leads to lots of use of !foo.isEmpty, which is confusing as 1) it's a double negative 2) one negation happens before the main expression and the other after.

Suggestions:

 + New method, e.g. hasElements, hasItems
 + Or supplement bool some(bool f(element)) with default some((e) => true)

Discussed here:

https://groups.google.com/a/dartlang.org/d/topic/misc/MfYkrFP84dw/discussion

@sethladd
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Triaged labels.

@lrhn
Copy link
Member

lrhn commented Sep 3, 2012

I think we should have hasElements on Collection. It should be a getter, and so should isEmpty.


Added this to the M2 milestone.
Added Accepted label.

@floitschG
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@larsbak
Copy link

larsbak commented May 28, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M5 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 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 Aug 4, 2014
@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 accepted labels Feb 29, 2016
@lrhn
Copy link
Member

lrhn commented Aug 11, 2017

Iterable has isNotEmpty and any now.

@lrhn lrhn closed this as completed Aug 11, 2017
dart-bot pushed a commit that referenced this issue Sep 13, 2021
New commits in this version:

git -C third_party/pkg/pub log --oneline cd7a43f2109f7e5eb22e73c7f4e15d25fd57598e..d95c5713dda518ed53ada70e00789e6aadbfbe48
d95c5713 (HEAD, origin/master, origin/HEAD) Remove duplicate global invocation on Windows (#3055)
4c5198df master->main (#3101)
e793fd52 More tool/test.dart tweaks (#3097)
1b228edd Report retracted packages (#3093)
4fedb6c5 Tweak strict dependencies error message for `_validateBenchmarkTestTool` (#3087)
e608ab6e Improve test script (#3091)
abf702c4 Detect potential leaks in `dart pub publish`. (#3049)
9941c1f9 Fix broken simplification of prerelease constraints (#3078)
f0cdfa27 format (#3086)
5a1242c6 Fix unicode terminal detection windows (#2933)
58e2296d Dart format (#3084)
1426601c use incremental compilation in the tool/test.dart script (#3075)
9954f851 Fix a typo (#3062)
44489b31 Use relative import for path.dart (#2959)
77702ab1 Always precompile scripts before running them (#3074)

Change-Id: I913ab9e3b5bc7181d483a2de96ec4ad917028b75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213262
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Jul 8, 2022
…1 revision)

https://dart.googlesource.com/dartdoc/+log/bf7cf5112bf2..adc5a45ddafb

2022-07-08 srawlins@google.com Move source-manipulating code from model_utils to model_node (#3074)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: Ic889570a9d57f4be140a5f822a50a678db3450fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250960
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
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. 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

8 participants