title: foreach function not working in Spark DataFrame
body: <p>According to DataFrames API, definition is:</p>
  
  <pre><code>public void foreach(scala.Function1&lt;Row,scala.runtime.BoxedUnit&gt; f)
  </code></pre>
  
  <p>Applies a function f to all rows.</p>
  
  <p>But when I am trying like </p>
  
  <pre><code>Dataframe df = sql.read()
      .format("com.databricks.spark.csv")
      .option("header","true")
      .load("file:///home/hadoop/Desktop/examples.csv");
  
  df.foreach(x-&gt;
  {
     System.out.println(x);
  });
  </code></pre>
  
  <p>I am getting compile time error. any mistake?</p>