2

I have a method in Scala with below syntax . I want to override this method in a java sub class. I am not sure what will be the equivalent syntax in Java for this method .

def createRecord(rdd: RDD[(String, Array[(String, Int)])])
2
  • what is the return type of the method? Commented May 17, 2017 at 18:11
  • Return type is Unit Commented May 17, 2017 at 18:14

2 Answers 2

4

the below is the java equivalent of the scala method createRecord. The reason why Int in scala is converted to an Object in Java is provided here

 import org.apache.spark.rdd.RDD;
 import scala.Tuple2;
 public void createRecord(RDD<Tuple2<String, Tuple2<String, Object>[]>> rdd) {

 }
Sign up to request clarification or add additional context in comments.

Comments

1

You can use The Java API RDD of spark as well and Integer (a class ) here as:

import scala.Tuple2;
import org.apache.spark.api.java.JavaRDD

 public void method(JavaRDD<Tuple2<String,Tuple2<String,Integer>[]>> rdd)
  {
      return the equivalent implementation
  }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.