Help converting 2.12 code to 2.13

Can someone help me convert this piece of code from 2.12 to 2.13?

I have a piece of code which was originally suggested by Patrick Römer, which is giving me a deprecation warning when I try to convert my project to 2.13. IntelliJ suggests that import scala.collection.JavaConverters._ is deprecated.
When I look at this stackoverflow article, I get even more confused. The article in one place suggests to use JavaConverters and in another place suggests to use JavaConversions.
What is the correct way to convert this code to 2.13?

case class CacheByJboss() extends Cache {
  type BDD_HASH = scala.collection.mutable.Map[(Int, Bdd, Bdd), BddNode]
  // this code was suggested by Patrick Römer
  import org.jboss.util.collection._

  import scala.collection.JavaConverters._
  val hash = new WeakValueHashMap[(Int, Bdd, Bdd), BddNode].asScala

  override def getBddSizeCount():(Long,Long) = {
    (hash.size, numAllocations)

  override def getOrCreate(label:Short,positive:Bdd,negative:Bdd):BddNode = {
    hash.get((label, positive, negative)) match {
      case Some(bdd: BddNode) => bdd
      case None | Some(null) =>
        val bdd = BddNode(label, positive, negative)
        numAllocations = 1L + numAllocations
        hash((label, positive, negative)) = bdd

In 2.13 the import changed to

import scala.jdk.CollectionConverters._
1 Like

Thanks. And do I need .asScala or not?

Yes. I think the automatic conversions were removed entirely.

The Scaladocs are quite comprehensive (follow the links):

1 Like