您好,谁能帮我解决这个错误,我尝试了很多方法
import scala.io.Source
import java.io._
object test1
{
def main(args: Array[String])
{
val a=Source.fromFile("pg1661.txt").mkString
val count=a.split("\\s+").groupBy(x=>x).mapValues(x=>x.length)
val writer=new PrintWriter(new File("output.txt"))
writer.write(count)
writer.close()
}
}
但它显示错误 @write(count) 并且错误是
Multiple markers at this line
- overloaded method value write with alternatives:
(java.lang.String)Unit <and> (Array[Char])Unit <and> (Int)Unit cannot be
applied to (scala.collection.immutable.Map[java.lang.String,Int])
- overloaded method value write with alternatives:
(java.lang.String)Unit <and> (Array[Char])Unit <and> (Int)Unit cannot be
applied to (scala.collection.immutable.Map[java.lang.String,Int])
请帮助我。在此先感谢