title: How to use map-function in SPARK with Java
body: <p>I try to read a csv-file in spark and I want to split the lines, which are comma-seperated, so that I have an RDD with a two dimensional Array. I am very new to Spark.</p>
  
  <p>I tried to do this:</p>
  
  <pre><code>public class SimpleApp 
  {   
      public static void main(String[] args) throws Exception 
      {       
          String master = "local[2]";
          String csvInput = "/home/userName/Downloads/countrylist.csv";
          String csvOutput = "/home/userName/Downloads/countrylist";
  
          JavaSparkContext sc = new JavaSparkContext(master, "loadwholecsv", System.getenv("SPARK_HOME"), System.getenv("JARS"));
  
          JavaRDD&lt;String&gt; csvData = sc.textFile(csvInput, 1);
          JavaRDD&lt;String&gt; words = csvData.map(new Function &lt;List&lt;String&gt;&gt;() { //line 43
                @Override
                public List&lt;String&gt; call(String s) {
                  return Arrays.asList(s.split("\\s*,\\s*"));
                }
              });
  
          words.saveAsTextFile(csvOutput);
      }
  }
  </code></pre>
  
  <p>This should split the lines and return an ArrayList. But I am not sure about this.
  I get this error:</p>
  
  <pre><code>SimpleApp.java:[43,58] wrong number of type arguments; required 2
  </code></pre>