`RDD[Double]` is `RDD[scala.Double]` instead of `RDD[java.lang.Double]`. If you call the function inline, Scala compiler will convert it to `double`. I think it is safe to do an explicit cast:

~~~
JavaRDD<Double>  predictions = (JavaRDD<Double>) model.predict(test.map(...).rdd())
~~~