Fix definition of Iterable on 'Iterable collections' page #5618
Labels
a.tut.codelab
Relates to codelabs hosted on dart.dev.
e1-hours
Can complete in < 8 hours of normal, not dedicated, work
fix.examples
Adds or changes example
from.page-issue
Reported in a reader-filed concern
p2-medium
Necessary but not urgent concern. Resolve when possible.
st.triage.ltw
Indicates Lead Tech Writer has triaged
Page URL
https://dart.dev/codelabs/iterables/
Page source
https://github.com/dart-lang/site-www/tree/main/./src/content/codelabs/iterables.md
Describe the problem
We read in What is an Iterable?
That would depend on the implementation of the interface.
Expected fix
Suggesting to add "...if the underlying data structure does not allow for a more efficient method", as would be expected.
Because clearly, using
elementAt()
on aList
does not result in linear traversal, but proper indexed access.The description for elementAt says:
We can also run a quick test of efficiency regarding accessing a
List
withelementAt()
vs accessing aSet
withelementAt()
:Result:
Additional context
No response
I would like to fix this problem.
The text was updated successfully, but these errors were encountered: