Fix build with additional WeakHash map implementation

This commit is contained in:
Luca Abbati 2019-07-19 17:05:40 +02:00
parent edacd7a41d
commit 95a963a364
No known key found for this signature in database
GPG Key ID: 74DBB952D9BA17F2
2 changed files with 9 additions and 1 deletions

View File

@ -108,7 +108,6 @@ public interface WeakMap<K, V> {
@Override
public synchronized V getOrCreate(K key, ValueSupplier<V> supplier) {
if (!map.containsKey(key)) {
map.put(key, supplier.get());
}

View File

@ -175,6 +175,15 @@ class WeakMapSuppliers {
public void putIfAbsent(final K key, final V value) {
map.putIfAbsent(key, value);
}
@Override
public V getOrCreate(K key, ValueSupplier<V> supplier) {
if (!map.containsKey(key)) {
map.put(key, supplier.get());
}
return map.get(key);
}
}
static class Inline implements WeakMap.Implementation {