Davide Giuseppe Farella
01/19/2019, 7:49 AMServiceBuilder
which I would like to keep private, but that doesn’t seem possible 😄 so at least I gave him an internal constructor, creating an public external constructor “scoped” with a context.Davide Giuseppe Farella
01/19/2019, 7:50 AMDavide Giuseppe Farella
01/19/2019, 7:50 AME.Kisaragi
02/19/2020, 2:59 AMJason
02/19/2020, 6:06 AMYyq2008
02/19/2020, 8:28 AMuser
02/19/2020, 11:25 AMuser
02/19/2020, 12:13 PMjojo.lichtenberger
02/19/2020, 2:57 PMjojo.lichtenberger
02/19/2020, 2:59 PMChills
02/20/2020, 2:55 AMMedamine Rihane
02/20/2020, 11:12 AMMedamine Rihane
02/20/2020, 11:13 AMvar listener: ((File, here i want instance that host the variable ) -> Unit)? = null
Bernhard
02/20/2020, 12:27 PMlistOf("b", "a").toSortedSet()
return [“a”, “b”]user
02/20/2020, 4:30 PMChills
02/20/2020, 5:41 PMChills
02/20/2020, 5:41 PM@Serializable
data class Person(val name:String? = null)
Leon K
02/20/2020, 7:03 PMclass SingleSlotCache<K, V> {
@Volatile
private var cacheData: Pair<K, V>? = null
@Synchronized
fun getValueBy(key: K, f: () -> V): V = cacheData
?.takeIf { (cachedKey, _) -> cachedKey == key }?.second
?: f().also { cacheData = Pair(key, it) }
}
as the whole function is synchronized, if one thread is currently accessing the value (and maybe calculating and writing it, because the key doesn't match) the next one to access it should have to wait, and then afterwards just use the value from the first thread (as long as the keys match), shouldn't they? Or am I missing something obvious in how @Synchronized
works or something...Bob Glamm
02/20/2020, 7:20 PMLeon K
02/20/2020, 7:24 PMFile
-> Power safe mode
) that you could try toughLeon K
02/20/2020, 7:24 PMBob Glamm
02/20/2020, 7:25 PMBob Glamm
02/20/2020, 7:26 PMLeon K
02/20/2020, 7:27 PMBob Glamm
02/20/2020, 7:28 PMLeon K
02/20/2020, 7:43 PMChills
02/21/2020, 8:05 PMursus
02/21/2020, 11:54 PMursus
02/21/2020, 11:56 PMjojo.lichtenberger
02/22/2020, 9:43 AM