I have a working understanding of Java. I understand reserved words. I also understand the basics of anonymous classes. I am reading this Spark example and see a "call" statement. What is the meaning of call
and @Override
? I see that call is not a reserved word -- but I also don't see it in the Spark docs or in the import statement. Could someone break down what is happening in this code? I get that it passes an anonymous class as a parameter (right?) -- and then that abstract class has an anonymous method called "call" (right?). But what is getting overwritten? Why the @Override
? What does call
refer to?
JavaPairRDD<String, Integer> ones = words.mapToPair(new PairFunction<String, String, Integer>() {
@Override
public Tuple2<String, Integer> call(String s) {
return new Tuple2<String, Integer>(s, 1);
}
});