:wave: Hello, new to Kotlin I’m trying to figure i...
# getting-started
h
👋 Hello, new to Kotlin I’m trying to figure it out about support thread-safe singleton Where I can find more about:
private val shared: CustomSingleton by _lazy_(LazyThreadSafetyMode.SYNCHRONIZED) *{* CustomSingleton() *}*
I aim to access this singleton and his custom variable, which includes an array (read and write) from different threads. Or can you please share what I need to learn 🙂 I really appreciate any help you can provide.
c
Hey, you can just write this 🙂 :
Copy code
object CustomSingleton {
    // your code
}
https://kotlinlang.org/docs/object-declarations.html#object-declarations-overview