I am new to Scala. I am confused by this compilation error:
I create this HashMap
and use it in a number of functions:
val valuesMap:mutable.Map[String,Int]=mutable.HashMap()
I have a function with this signature:
def saveToPjCsv(map:mutable.Map[Any,Any], fileName: String, outputDir: String): Unit =
I pass the HashMap
to the function:
DataFrameUtils.saveToPjCsv(valuesMap,"categoryMap",".\\DataManipulation\\")
And get this compilation error:
error: overloaded method value saveToPjCsv with alternatives: [INFO]
(map: scala.collection.mutable.Map[Any,Any],fileName: String,outputDir: String)Unit [INFO] (df: org.apache.spark.sql.DataFrame,fileName: String,outputDir: String)Unit [INFO] cannot be applied to (scala.collection.mutable.Map[String,Int], String, String)
Why doesn't Map[Any,Any]
accept Map[String,Int]
?