Best practices for mixing in Scala concurrent.Map

后端 未结 5 2062
温柔的废话
温柔的废话 2021-02-01 03:37

The ScalaDoc says this about concurrentMap: \"Deprecated (Since version 2.10.0) Use scala.collection.concurrent.Map instead.\" Unfortunately, the rest of the Scala

5条回答
  •  无人共我
    2021-02-01 03:54

    Taken from this comment directly: https://stackoverflow.com/a/49689669/7082628

    In 2018, apparently you can just do this:

    import java.util.concurrent.ConcurrentHashMap
    
    val m: ConcurrentHashMap[String,MyClass] = new ConcurrentHashMap
    

提交回复
热议问题