简体   繁体   中英

Scala method override in Java

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)])])

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) {

 }

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
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM