title: Scala - Count the number of occurrences of every key in an Iterator
body: <p>I have an iterator containing some key value pairs.
  e.g </p>
  
  <blockquote>
    <p>(jen,xyz) (ken, zxy) (jen,asd) (ken, asdf)</p>
  </blockquote>
  
  <p>The results should be </p>
  
  <blockquote>
    <p>(jen,2) (ken, 2)</p>
  </blockquote>
  
  <p>How do I use the count function (or any other) to count the number of occurrences of each key in the iterator of that particular collection.</p>
  
  <p><strong>Edit:</strong>
  The collection that this iterator represend in my use-case has a large number of records, possibly in the range of millions, no I need the most efficient (less time complexity) way to do this. I found out that the default <strong>count</strong> method was a pretty fast, and that it could be somehow used to produce the desire result.</p>