1
我定義爲以下的ConcurrentHashMap對象:斯卡拉Java的深度地圖轉換(ConcurrentHashMap的)
import scala.collection.JavaConversions._
val storage: ConcurrentMap[String,ConcurrentMap[Int,ConcurrentMap[String,Double]]] =
new ConcurrentHashMap[String,ConcurrentHashMap[Int,ConcurrentHashMap[String,Double]]]
和Scala(2.8.1)抱怨在編譯,出現以下錯誤:
found : java.util.concurrent.ConcurrentHashMap[String,java.util.concurrent.ConcurrentHashMap[String,String]]
required: scala.collection.mutable.ConcurrentMap[String,scala.collection.mutable.ConcurrentMap[String,String]]
但當我嘗試下面的代碼,它的工作原理:
val storage: ConcurrentMap[String,Double] = new ConcurrentHashMap[String,Double]
我感謝您的評論如何解決此錯誤。