Spark 2.0.0 Arrays.asList not working - incompatible types
<p>Following code works with Spark 1.5.2 but not with Spark 2.0.0. I am using Java 1.8.</p>

<pre><code>final SparkConf sparkConf = new SparkConf();
sparkConf.setMaster("local[4]"); // Four threads
final JavaSparkContext javaSparkContext = new JavaSparkContext(sparkConf);
final JavaRDD&lt;String&gt; javaRDDLines = javaSparkContext.textFile("4300.txt");
final JavaRDD&lt;String&gt; javaRDDWords = javaRDDLines.flatMap(line -&gt; Arrays.asList(line.split(" ")));
</code></pre>

<p>I get following error</p>

<pre><code>Error:(46, 66) java: incompatible types: no instance(s) of type variable(s) T exist so that java.util.List&lt;T&gt; conforms to java.util.Iterator&lt;U&gt;
</code></pre>

<p>I am unable to figure out if the Spark API has changed or something else. Please help. Thanks.</p>