Minor CachedValue fix
This commit is contained in:
parent
25c64db0a1
commit
c30be20e49
@ -8,9 +8,7 @@ class CachedValue<T>(private val factory: () -> T) : Lazy<T> {
|
||||
get() {
|
||||
val local = _val
|
||||
return local ?: synchronized(this) {
|
||||
val newInstance = factory()
|
||||
_val = newInstance
|
||||
newInstance
|
||||
_val ?: factory().also { _val = it }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user