title: How to save a Map result to a text file in Spark scala?
body: <p>I have this:</p>
  
  <pre><code>val tokenFreq = reverseKey.countByKey
  // tokenFreq: scala.collection.Map[String,Long] = Map(ABIGAIL -&gt; 3,...
  </code></pre>
  
  <p>and I want to save the tokenFreq's result into a text file. </p>
  
  <p>I tried to use saveAsTextFile, but it says:</p>
  
  <blockquote>
    <p>error: value saveAsTextFile is not a member of scala.collection.Map[String,Long]</p>
  </blockquote>