title: value saveAsTextFile is not a member of org.apache.spark.streaming.dstream.DStream[(String, Long)]
body: <p>I am try to save my wordcount result in file.</p>
  
  <pre><code>val wordCounts = words.map(x =&gt; (x, 1L)).reduceByKey(_ + _)
  wordCounts.saveAsTextFile("/home/hadoop/datafile1")
  </code></pre>
  
  <p>But it is showing </p>
  
  <pre><code>value saveAsTextFile is not a member of org.apache.spark.streaming.dstream.DStream[(String, Long)]              [error]     wordCounts.saveAsTextFile("/home/hadoop/datafile1")
  </code></pre>
  
  <p>I am using spark 2.1. I show  one answer which is suggesting old spark version.But I want to do in spark 2.1. Thanks.</p>