it seems (If I used your edited suggestion) that I no longer need

```
import java.{util => ju}
```

Here is the code I’m using, that seems to work. And Yes I have to check that `get`

returns `None`

or `Some(null)`

.

```
import scala.collection.mutable
val hash: mutable.Map[(Int,Bdd,Bdd), BddNode] = {
// this code was suggested by Patrick Römer
// https://users.scala-lang.org/t/id-like-a-weak-hash-table-which-allows-gc-when-value-is-otherwise-unreferenced/4681/8?u=jimka
import scala.collection.JavaConverters._
import org.jboss.util.collection._
new WeakValueHashMap[(Int,Bdd,Bdd), BddNode].asScala
}
var hashCount:Long = -1
def apply(label: Int, positive: Bdd, negative: Bdd): Bdd = {
if (positive == negative)
positive
else {
hash.get((label, positive, negative)) match {
case Some(bdd: BddNode) => bdd
case None | Some(null) => { // Some(null) is necessary because the get of WeakValueHashMap sometimes returns Some(null)
hashCount = 1 + hashCount
if ( 0 == (hashCount % 100000))
println(s"bdd hash size=${hash.size} hashCount=$hashCount")
val bdd = BddNode(label, positive, negative)
hash((label, positive, negative)) = bdd
bdd
}
}
}
}
```

Here is the output when I run my tests, so I see that the GC does indeed remove some entries from the hash table.

```
bdd hash size=0 hashCount=0
bdd hash size=81416 hashCount=100000
bdd hash size=165414 hashCount=200000
bdd hash size=261157 hashCount=300000
bdd hash size=361157 hashCount=400000
bdd hash size=456206 hashCount=500000
bdd hash size=556206 hashCount=600000
bdd hash size=656206 hashCount=700000
bdd hash size=736279 hashCount=800000
bdd hash size=836279 hashCount=900000
bdd hash size=936279 hashCount=1000000
bdd hash size=1036279 hashCount=1100000
bdd hash size=1104525 hashCount=1200000
bdd hash size=1204525 hashCount=1300000
...
...
```