scalapb.descriptors.ConcurrentWeakReferenceMap.scala Maven / Gradle / Ivy
The newest version!
package scalapb.descriptors
/** Javascript (and hence Scala.js) does not have WeakReferences and WeahHashMap, so we use
* a normal HashMap. */
private [descriptors] class ConcurrentWeakReferenceMap[K, V] {
private val underlying: collection.mutable.Map[K, V] = new collection.mutable.HashMap[K, V]()
def getOrElseUpdate(key: K, newValue: => V): V = this.synchronized {
underlying.getOrElseUpdate(key, newValue)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy