Skip to content

Please help to solve iterators5.rs #2038

Closed Answered by LeoniePhiline
Leo777 asked this question in Q&A
Discussion options

You must be logged in to vote

Alternatively, use filter():

map
    .values()
    .filter(|v| *v == &value)
    .count()

Note that in count_collection_iterator() you can call count_iterator() instead of re-implementing the functionality. Something like:

collection
    .iter()
    .map(|map| count_iterator(map, value))
    .sum()

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mo8it
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants
Converted from issue

This discussion was converted from issue #812 on July 10, 2024 11:35.