title: How do I process this list of futures result
body: <p>I have the following function:</p>
  
  <pre><code>def countAllFriends(currUser: String, members: List[String]): Future[Map[String, Integer]] = {
      val results: List[Future[List[String]]] = members.map(currUser =&gt; retrieveAllFriends( currUser))
  
  
      //go through the results, and return a future of a map of usernames to the number of times that username exists in the list
  
  
    }
  </code></pre>
  
  <p>How can I implement the function so that I get a return type of <code>Future[Map[String, Integer]]</code> ?</p>
  
  <p>If a future fails, then I don't want the whole thing to fail, I just want to have a special entry in the map called 'failures' which will count the number of failed futures.</p>