Replies: 1 comment
-
| fn count_collection_iterator(collection: &[HashMap<String, Progress>], value: Progress) -> usize {
    collection.iter().fold(0, |count, map| {
        // Both of these methods pass the test. 
        // The difference in the closure in the filter is not important, it is just to make sure the types on both sides are the same.
        
        // count + map.iter().filter(|i| i.1 == &value).count()
        count + map.values().filter(|&&val| val == value).count()
    })
} | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I am up to
iterators5.rsand got the first function completed (count_iterator) solved, but I am having trouble with the second function calledcount_collection_iterator. As I understand it, I need to use thefoldmethod, but I am unclear how to use it. Specifically how to match it with thevalue: Progressthat is passed in.Beta Was this translation helpful? Give feedback.
All reactions