diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt index c9a61d5cc..48e390b7c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt @@ -25,14 +25,13 @@ import java.lang.ref.WeakReference import java.util.concurrent.ConcurrentSkipListMap import java.util.function.BiConsumer -class LargeSoftCache : CacheOperations { - protected val cache = ConcurrentSkipListMap>() +class LargeSoftCache : CacheOperations { + private val cache = ConcurrentSkipListMap>() fun keys() = cache.keys fun get(key: K): V? { - val softRef = cache.get(key) - if (softRef == null) return null + val softRef = cache.get(key) ?: return null val value = softRef.get() return if (value != null) { @@ -135,7 +134,7 @@ class LargeSoftCache : CacheOperations { .forEach(BiConsumerWrapper(this, consumer)) } - class BiConsumerWrapper( + class BiConsumerWrapper( val cache: LargeSoftCache, val inner: BiConsumer, ) : BiConsumer> {