Skip to content

Instantly share code, notes, and snippets.

@alibahaaa
Created January 19, 2023 11:19
Embed
What would you like to do?
class Singleton private constructor() {
companion object {
private var instance: Singleton? = null
fun getInstance(): Singleton {
if (instance == null) {
instance = Singleton()
}
return instance!!
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment