How about

```
Option(internalJavaMap.get(key)).map { weakValue =>
    val value = weakValue.weakValue.get
    if (value == null) {
        internalJavaMap.remove(key)
    }
    value
}
```
?