package spark.examples;

import scala.Tuple2;
import scala.collection.immutable.StringOps;
import spark.api.java.JavaPairRDD;
import spark.api.java.JavaRDD;
import spark.api.java.JavaSparkContext;
import spark.api.java.function.FlatMapFunction;
import spark.api.java.function.Function2;
import spark.api.java.function.PairFunction;

import java.util.Arrays;
import java.util.List;

public class JavaWordCount {

  public static void main(String[] args) throws Exception {

    if (args.length < 2) {
      System.err.println("Usage: JavaWordCount <master> <file>");
      System.exit(1);
    }

    JavaSparkContext ctx = new JavaSparkContext(args[0], "JavaWordCount");
    JavaRDD<String> lines = ctx.textFile(args[1], 1);

    JavaPairRDD<String, Integer> counts = lines.flatMap(new FlatMapFunction<String, String>() {
      public Iterable<String> apply(String s) {
        StringOps op = new StringOps(s);
        return Arrays.asList(op.split(' '));
      }
    }).map(new PairFunction<String, String, Integer>() {
      public Tuple2<String, Integer> apply(String s) {
        return new Tuple2(s, 1);
      }
    }).reduceByKey(new Function2<Integer, Integer, Integer>() {
      public Integer apply(Integer i1, Integer i2) {
        return i1 + i2;
      }
    });

    List<Tuple2<String, Integer>> output = counts.collect();
    for (Tuple2 tuple : output) {
      System.out.print(tuple._1 + ": ");
      System.out.println(tuple._2);
    }
    System.exit(0);
  }
}

@@ -43,53 +43,8 @@
 e2;%0A
-import scala.collection.immutable.StringOps;%0A
 impo
@@ -821,49 +821,8 @@
 ) %7B%0A
-        StringOps op = new StringOps(s);%0A
     
@@ -850,20 +850,19 @@
 ist(
-op
+s
 .split(
-' '
+%22 %22
 ));%0A
@@ -1297,16 +1297,18 @@
 ut.print
+ln
 (tuple._
@@ -1319,36 +1319,11 @@
 %22: %22
-);%0A      System.out.println(
+ + 
 tupl

Remove StringOps.split() from Java WordCount.